examples/mcabberrc.lua
changeset 99 ed4676536ed9
parent 84 c0db7efde255
child 106 c60fe499f075
equal deleted inserted replaced
98:59aeae623ac6 99:ed4676536ed9
    54 - del_feature    - delete string from feature list
    54 - del_feature    - delete string from feature list
    55 - add_completion - adds word to completions
    55 - add_completion - adds word to completions
    56 - del_completion - removes word from completions
    56 - del_completion - removes word from completions
    57 - command        - adds/removes mcabber command
    57 - command        - adds/removes mcabber command
    58 - option         - sets/gets mcabber option
    58 - option         - sets/gets mcabber option
       
    59 - hook           - creates hook handler object
    59 
    60 
    60 STRUCTURE
    61 STRUCTURE
    61 
    62 
    62 To allow your chunk of configuration (eg foo.lua) to play friendly with other, do:
    63 To allow your chunk of configuration (eg foo.lua) to play friendly with other, do:
    63 
    64 
   179 		else
   180 		else
   180 			main.run ( 'status online ' .. mess )
   181 			main.run ( 'status online ' .. mess )
   181 		end
   182 		end
   182 	end )
   183 	end )
   183 
   184 
   184 -- commands to allow leading smileys
       
   185 for k, arg in ipairs ( { ')', '/', '(', 'D', '-/', 'S', '1', ']', '[' } ) do
       
   186 	main.command ( arg,
       
   187 		function ( args )
       
   188 			main.run ( 'say :' .. arg .. ' ' .. args )
       
   189 		end )
       
   190 end
       
   191 
       
   192 -- HOOKS
       
   193 
       
   194 hooks_d = {
       
   195 	['hook-message-in']       = { },
       
   196 	['hook-message-out']      = { },
       
   197 	['hook-status-change']    = { },
       
   198 	['hook-my-status-change'] = { },
       
   199 	['hook-post-connect']     = { },
       
   200 	['hook-pre-disconnect']   = { },
       
   201 	['hook-start']            = { },
       
   202 	['hook-quit']             = { },
       
   203 }
       
   204 
       
   205 -- hook:
       
   206 -- - hook-message-in
       
   207 --   jid
       
   208 --   groupchat
       
   209 --   message
       
   210 -- - hook-message-out
       
   211 --   jid
       
   212 --   message
       
   213 -- - hook-status-change
       
   214 --   jid
       
   215 --   resource
       
   216 --   new_status
       
   217 --   old_status
       
   218 --   message
       
   219 -- - hook-my-status-change
       
   220 --   new_status
       
   221 --   message
       
   222 -- - hook-post-connect
       
   223 -- - hook-pre-disconnect
       
   224 -- - hook-start
       
   225 -- - hook-quit
       
   226 function hook_handler ( args )
       
   227 	if [hooks_d[args.hook] then
       
   228 		for mod, cb in pairs ( hooks_d[args.hook] ) do
       
   229 			if cb then
       
   230 				cb ( args )
       
   231 			end
       
   232 		end
       
   233 	end
       
   234 end
       
   235 
       
   236 -- FIXME
       
   237 
       
   238 hooks_d['hook-post-connect'].fifoperms =
       
   239 	function ( args )
       
   240 		-- TODO: posix
       
   241 		os.execute ( 'chmod 0666 ' .. main.option ( 'fifo_name' ) )
       
   242 		hooks_d['hook-post-connect'].fifoperms = nil
       
   243 	end
       
   244 
       
   245 -- SAVING URLS TO FILE
   185 -- SAVING URLS TO FILE
   246 
   186 -- These are implemented in C in urlopen and openurl modules
   247 require 'urls'
   187 
       
   188 -- require 'urls'
   248 
   189 
   249 -- TRANSPORTED BUDDIES AVAILABILITY INDICATION
   190 -- TRANSPORTED BUDDIES AVAILABILITY INDICATION
   250 
   191 -- After all, I do not use this anymore :/
   251 require 'transports'
   192 -- But you can try.
       
   193 
       
   194 -- require 'transports'
   252 
   195 
   253 -- BEEPING ON ALL MESSAGES
   196 -- BEEPING ON ALL MESSAGES
   254 
   197 -- Implemented in C by in-tree beep module
   255 require 'beep'
   198 
       
   199 -- require 'beep'
   256 
   200 
   257 -- MARKING
   201 -- MARKING
   258 
   202 -- Implemented in C in marking module
   259 require 'marking'
   203 
       
   204 -- require 'marking'
   260 
   205 
   261 -- JOBS
   206 -- JOBS
   262 
   207 -- Somewhat error-prone, requires jobs file existance, never seriously used by me :(
   263 require 'jobs'
   208 
       
   209 -- require 'jobs'
   264 
   210 
   265 -- ROOM NICK COMPLETION
   211 -- ROOM NICK COMPLETION
   266 
   212 -- Well, it's sorta hacky, but I do use it
   267 require 'room_priv'
   213 
       
   214 -- require 'room_priv'
   268 
   215 
   269 -- FORMS
   216 -- FORMS
   270 
   217 
   271 require 'forms'
   218 require 'forms'
   272 
   219 
   283 -- MULTI-USER CHAT (XEP-0045)
   230 -- MULTI-USER CHAT (XEP-0045)
   284 
   231 
   285 require 'muc'
   232 require 'muc'
   286 
   233 
   287 -- IN-BAND BYTESTREAMS (XEP-0047)
   234 -- IN-BAND BYTESTREAMS (XEP-0047)
   288 
   235 -- Implemented in C in streams module
   289 require 'ibb'
   236 
       
   237 -- require 'ibb'
   290 
   238 
   291 -- VCARD-TEMP (XEP-0054)
   239 -- VCARD-TEMP (XEP-0054)
   292 
   240 
   293 require 'vcard'
   241 require 'vcard'
   294 
   242 
   299 -- OUT OF BAND DATA (XEP-0066)
   247 -- OUT OF BAND DATA (XEP-0066)
   300 
   248 
   301 require 'oob'
   249 require 'oob'
   302 
   250 
   303 -- MALICIOUS STANZAS (XEP-0076)
   251 -- MALICIOUS STANZAS (XEP-0076)
   304 
   252 -- Well, that's joke XEP and joke module
   305 require 'evil'
   253 
       
   254 -- require 'evil'
   306 
   255 
   307 -- IN-BAND REGISTRATION (XEP-0077)
   256 -- IN-BAND REGISTRATION (XEP-0077)
   308 
   257 
   309 require 'register'
   258 require 'register'
   310 
   259 
   311 -- USER LOCATION (XEP-0080)
   260 -- USER LOCATION (XEP-0080)
   312 
   261 -- Implemented in C in geoloc module
   313 require 'geoloc'
   262 
       
   263 -- require 'geoloc'
   314 
   264 
   315 -- USER AVATAR (XEP-0084)
   265 -- USER AVATAR (XEP-0084)
   316 
   266 -- Implemented in C in avatar module
   317 require 'avatar'
   267 
       
   268 -- require 'avatar'
   318 
   269 
   319 -- USER MOOD (XEP-0107)
   270 -- USER MOOD (XEP-0107)
   320 
   271 -- Implemented in C in mood module
   321 require 'mood'
   272 
       
   273 -- require 'mood'
   322 
   274 
   323 -- USER ACTIVITY (XEP-0108)
   275 -- USER ACTIVITY (XEP-0108)
   324 
   276 -- Implemented in C in activity module
   325 require 'activity'
   277 
       
   278 -- require 'activity'
   326 
   279 
   327 -- USER TUNE (XEP-0118)
   280 -- USER TUNE (XEP-0118)
   328 
   281 -- Implemented in C in tune module
   329 require 'tune'
   282 
       
   283 -- require 'tune'
   330 
   284 
   331 -- REMOTE CONTROLLING CLIENTS (XEP-0146)
   285 -- REMOTE CONTROLLING CLIENTS (XEP-0146)
   332 
   286 
   333 require 'remote'
   287 require 'remote'
   334 
   288 
   335 -- PERSONAL EVENTING PROTOCOL (XEP-0163)
   289 -- PERSONAL EVENTING PROTOCOL (XEP-0163)
       
   290 -- Implemented in C in pep module
   336 
   291 
   337 -- XMPP PING (XEP-0199)
   292 -- XMPP PING (XEP-0199)
   338 
   293 -- Included into upstream as /request ping
   339 require 'ping'
   294 
       
   295 -- require 'ping'
   340 
   296 
   341 -- ATTENTION (XEP-0224)
   297 -- ATTENTION (XEP-0224)
   342 
   298 
   343 require 'attention'
   299 require 'attention'
   344 
   300