author | Myhailo Danylenko <isbear@ukrpost.net> |
Sat, 30 Jul 2016 05:05:19 +0300 | |
changeset 154 | e63030a181f0 |
parent 136 | 2b04fad2f61a |
permissions | -rw-r--r-- |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
1 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
2 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
3 |
--[[ |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
4 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
5 |
DESCRIPTION |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
6 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
7 |
This is a demo config file to show, what you can do with lua. |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
8 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
9 |
Feature list: |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
10 |
XEP-0004 Forms parsing and filling |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
11 |
XEP-0030 Info/items discovery requests (mcabber already can do replies) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
12 |
XEP-0047 In-Bound Byte Streams (sending, receiving, saving with specified name, rejecting) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
13 |
XEP-0077 In-Band Registration (only registration, but with data forms too) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
14 |
XEP-0146 Remote commands requests |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
15 |
Jobs (actions, fired when some event occurs, now in one file, updated on exit) |
8 | 16 |
Room nicks completion |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
17 |
MPD status polling (can be turned off) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
18 |
Beep on all messages, even on chatroom ones |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
19 |
Url saving to file (for urlview) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
20 |
Transported buddies availability indication |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
21 |
Actions on multiple marked buddies |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
22 |
Fallback commands (localized also! :) ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
23 |
Help for fallback commands (well, I know, that it can be done with mcabber's help system, but it requires access to system files...) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
24 |
All features have native mcabber interface |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
25 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
26 |
REQUIREMENTS |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
27 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
28 |
liblua-loudmouth (lm.lua and loudmouth.so) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
29 |
liblua-socket - mpd |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
30 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
31 |
NOTES |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
32 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
33 |
Ibb uses own iq handler. This is the laziest way to implement this. |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
34 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
35 |
BUILTINS |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
36 |
|
9 | 37 |
print (global) - prints to log/status/logwindow |
38 |
dofile (global) - loads lua file from default mcabber location |
|
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
39 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
40 |
main methods: |
9 | 41 |
- run - run literal mcabber command |
42 |
- beep - beep |
|
43 |
- log - print to log w/specified priority |
|
44 |
- print_info - print info into specified buffer |
|
45 |
- config_file - format full file name from relative to mcabber's config dir |
|
46 |
- status - get current user status and message |
|
47 |
- roster - get list of roster jids (rooms, buddies and agents) |
|
48 |
- current_buddy - get jid of current buddy |
|
49 |
- buddy_info - get table with info about jid and its resources |
|
50 |
- connection - get lightuserdata for mcabber's lm connection |
|
51 |
- timer - run function periodically |
|
52 |
- bgread - run command and read it's output in background |
|
53 |
- add_feature - add string to feature list (for disco#info) |
|
54 |
- del_feature - delete string from feature list |
|
55 |
- add_completion - adds word to completions |
|
56 |
- del_completion - removes word from completions |
|
57 |
- command - adds/removes mcabber command |
|
58 |
- option - sets/gets mcabber option |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
59 |
- hook - creates hook handler object |
9 | 60 |
|
61 |
STRUCTURE |
|
62 |
||
63 |
To allow your chunk of configuration (eg foo.lua) to play friendly with other, do: |
|
64 |
||
65 |
- place it into a separate file, eg foo.lua |
|
66 |
- if you need hooks, do |
|
67 |
hook_d[hookname].foo = function ( args ) foo ( ) end |
|
68 |
- if you register commands, also do |
|
69 |
commands_help['foo'] = "arg1 arg2\n\nFoo does bar." |
|
70 |
- append to the end of this file |
|
71 |
dopath 'foo' |
|
72 |
- try to be friendly to module reloads, eg unregister handlers, where appropriate, |
|
73 |
reset bindings |
|
74 |
- you can omit unregistering of commands and xmpp features - module will unregister |
|
75 |
them automatically. |
|
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
76 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
77 |
--]] |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
78 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
79 |
-- This is a hack to allow loading of lm.lua and loudmouth.so from ~/.mcabber |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
80 |
-- instead of installing them system-wide |
57 | 81 |
-- FIXME to C. we now require this by require'ing interdependencies between modules. |
31
54957980a83a
yesno in C, no config_file
Myhailo Danylenko <isbear@ukrpost.net>
parents:
27
diff
changeset
|
82 |
if main.option ( 'lua_extra_include' ) then |
33 | 83 |
package.path = main.fileoption ( 'lua_extra_include' ) .. '/?.lua;' .. package.path |
84 |
package.cpath = main.fileoption ( 'lua_extra_include' ) .. '/?.so;' .. package.cpath |
|
31
54957980a83a
yesno in C, no config_file
Myhailo Danylenko <isbear@ukrpost.net>
parents:
27
diff
changeset
|
85 |
end |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
86 |
|
8 | 87 |
-- COMMON SUPPORT ROUTINES |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
88 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
89 |
function shell_escape ( str ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
90 |
if str then |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
91 |
return "'" .. str:gsub ( "'", "'\\''" ) .. "'" |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
92 |
else |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
93 |
return "''" |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
94 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
95 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
96 |
|
31
54957980a83a
yesno in C, no config_file
Myhailo Danylenko <isbear@ukrpost.net>
parents:
27
diff
changeset
|
97 |
-- This is for debugging purposes, not for reloading. For that see jobs. |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
98 |
function table_to_string ( tab, pre ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
99 |
local prefix = pre or "" |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
100 |
local tbls, jk = "", "" |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
101 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
102 |
for key, val in pairs ( tab ) do |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
103 |
if type ( val ) == 'table' then |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
104 |
tbls = string.format ( "%s %s%s = %s,\n", tbls, prefix, tostring(key), table_to_string ( val, " " .. prefix ) ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
105 |
else |
31
54957980a83a
yesno in C, no config_file
Myhailo Danylenko <isbear@ukrpost.net>
parents:
27
diff
changeset
|
106 |
jk = string.format ( "%s %s = \"%s\",", jk, tostring(key), tostring(val) ) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
107 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
108 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
109 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
110 |
if tbls == "" then |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
111 |
return string.format ( "{%s }", jk:sub ( 1, -2 ) ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
112 |
else |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
113 |
return string.format ( "{%s\n%s%s}", jk, tbls, prefix ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
114 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
115 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
116 |
|
6 | 117 |
-- COMMANDS |
118 |
||
121
75a7d595817c
Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents:
106
diff
changeset
|
119 |
--[[ Help strings should not contain command, only arguments. This is necessary to support soft aliases. |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
120 |
commands_help = { |
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
121 |
post = "filename\n\nSends file as a message. Just shorthand.", |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
122 |
beep = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables beeping on all messages.\nIf state is omitted, prints current state.", |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
123 |
cmd = "shell_command\n\nRuns shell command in background and sends output to current buddy.\nWorks asynchroneously, and may break long output in the middle of line", |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
124 |
exthelp = "[command]\n\nPrints help for a given command, or list of available help topics.", |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
125 |
['join!'] = "\n\nForcibly joins to current buddy. Just saves you typing of full room name (that can be quite long) in a case of a non-bookmarked rooms.", |
12
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
126 |
count = "\n\nPrints number of resources of current buddy. Useful to determine member count of large room.", |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
127 |
toggle = "\n\nToggles away/online status.", |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
128 |
} |
121
75a7d595817c
Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents:
106
diff
changeset
|
129 |
--]] |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
130 |
|
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
131 |
main.command ( 'post', |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
132 |
function ( args ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
133 |
main.run ( 'say_to -f ' .. args .. ' .' ) |
34
8206d7cb1447
Args auto-parsing, use main.binding
Myhailo Danylenko <isbear@ukrpost.net>
parents:
33
diff
changeset
|
134 |
end, false, 'filename' ) |
121
75a7d595817c
Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents:
106
diff
changeset
|
135 |
--[[ |
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
136 |
main.command ( 'cmd', |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
137 |
function ( args ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
138 |
local to = main.current_buddy () |
106
c60fe499f075
s/send_to/say_to/ (reported by McKael)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
99
diff
changeset
|
139 |
main.run ( ('say_to -q %q $ %s'):format ( to, args ) ) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
140 |
main.bgread ( args, |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
141 |
function ( data ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
142 |
if data then |
106
c60fe499f075
s/send_to/say_to/ (reported by McKael)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
99
diff
changeset
|
143 |
main.run ( ('say_to -q %q %s'):format ( to, data ) ) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
144 |
return true |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
145 |
else |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
146 |
return false |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
147 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
148 |
end ) |
34
8206d7cb1447
Args auto-parsing, use main.binding
Myhailo Danylenko <isbear@ukrpost.net>
parents:
33
diff
changeset
|
149 |
end, false, 'filename' ) |
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
150 |
main.command ( 'exthelp', |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
151 |
function ( args ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
152 |
if commands_help[args] then |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
153 |
print ( "\n /" .. args .. ' ' .. commands_help[args] ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
154 |
else |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
155 |
print ( "No help for this command." ) |
41
9e39fd8a20df
Updated to library module ibb
Myhailo Danylenko <isbear@ukrpost.net>
parents:
37
diff
changeset
|
156 |
local list = "Help available for commands: " |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
157 |
for k in pairs (commands_help) do |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
158 |
list = list .. k .. ', ' |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
159 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
160 |
print ( list:sub ( 1, -3 ) ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
161 |
print ( "For built-in mcabber commands see /help" ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
162 |
end |
34
8206d7cb1447
Args auto-parsing, use main.binding
Myhailo Danylenko <isbear@ukrpost.net>
parents:
33
diff
changeset
|
163 |
end, false, 'cmd' ) |
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
164 |
main.command ( 'join!', |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
165 |
function ( args ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
166 |
main.run ( 'room join ' .. main.current_buddy () ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
167 |
end ) |
7
eb6d89bf1fbf
Commands and init improvements
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
168 |
main.command ( 'count', |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
169 |
function ( args ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
170 |
local count = 0 |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
171 |
for resource in pairs ( main.buddy_info ( main.current_buddy () ).resources ) do |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
172 |
count = count + 1 |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
173 |
end |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
174 |
print ( "Resource count: " .. count ) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
175 |
end ) |
121
75a7d595817c
Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents:
106
diff
changeset
|
176 |
--]] |
12
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
177 |
main.command ( 'toggle', |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
178 |
function ( args ) |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
179 |
local stat, mess = main.status () |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
180 |
if stat == 'o' then |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
181 |
main.run ( 'status away ' .. mess ) |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
182 |
else |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
183 |
main.run ( 'status online ' .. mess ) |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
184 |
end |
a52d61f57e0d
Toggle status function
Myhailo Danylenko <isbear@ukrpost.net>
parents:
10
diff
changeset
|
185 |
end ) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
186 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
187 |
-- SAVING URLS TO FILE |
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
188 |
-- These are implemented in C in urlopen and openurl modules |
8 | 189 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
190 |
-- require 'urls' |
8 | 191 |
|
192 |
-- TRANSPORTED BUDDIES AVAILABILITY INDICATION |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
193 |
-- After all, I do not use this anymore :/ |
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
194 |
-- But you can try. |
8 | 195 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
196 |
-- require 'transports' |
8 | 197 |
|
198 |
-- BEEPING ON ALL MESSAGES |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
199 |
-- Implemented in C by in-tree beep module |
8 | 200 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
201 |
-- require 'beep' |
8 | 202 |
|
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
203 |
-- MARKING |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
204 |
-- Implemented in C in marking module |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
205 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
206 |
-- require 'marking' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
207 |
|
50 | 208 |
-- JOBS |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
209 |
-- Somewhat error-prone, requires jobs file existance, never seriously used by me :( |
50 | 210 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
211 |
-- require 'jobs' |
50 | 212 |
|
213 |
-- ROOM NICK COMPLETION |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
214 |
-- Well, it's sorta hacky, but I do use it |
50 | 215 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
216 |
-- require 'room_priv' |
50 | 217 |
|
125
3e2421384d7a
Examples updates (shortenurl)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
121
diff
changeset
|
218 |
-- SHORTENURL |
3e2421384d7a
Examples updates (shortenurl)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
121
diff
changeset
|
219 |
-- Use goo.gl to shorten urls |
3e2421384d7a
Examples updates (shortenurl)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
121
diff
changeset
|
220 |
|
3e2421384d7a
Examples updates (shortenurl)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
121
diff
changeset
|
221 |
require 'shortenurl' |
3e2421384d7a
Examples updates (shortenurl)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
121
diff
changeset
|
222 |
|
67
d33ca5572e91
Fully object forms interface (untested)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
66
diff
changeset
|
223 |
-- FORMS |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
224 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
225 |
require 'forms' |
67
d33ca5572e91
Fully object forms interface (untested)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
66
diff
changeset
|
226 |
|
d33ca5572e91
Fully object forms interface (untested)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
66
diff
changeset
|
227 |
-- DATA FORMS (XEP-0004) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
228 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
229 |
-- PRIVACY LISTS (XEP-0016) |
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
230 |
|
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
231 |
require 'privacy' |
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
232 |
|
32
524fde5be49a
Yesno completion in C
Myhailo Danylenko <isbear@ukrpost.net>
parents:
31
diff
changeset
|
233 |
-- SERVICE DISCOVERY (XEP-0030) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
234 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
235 |
require 'disco' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
236 |
|
77
8a7f7829f4df
Muc room configuration by owner
Myhailo Danylenko <isbear@ukrpost.net>
parents:
71
diff
changeset
|
237 |
-- MULTI-USER CHAT (XEP-0045) |
8a7f7829f4df
Muc room configuration by owner
Myhailo Danylenko <isbear@ukrpost.net>
parents:
71
diff
changeset
|
238 |
|
8a7f7829f4df
Muc room configuration by owner
Myhailo Danylenko <isbear@ukrpost.net>
parents:
71
diff
changeset
|
239 |
require 'muc' |
8a7f7829f4df
Muc room configuration by owner
Myhailo Danylenko <isbear@ukrpost.net>
parents:
71
diff
changeset
|
240 |
|
41
9e39fd8a20df
Updated to library module ibb
Myhailo Danylenko <isbear@ukrpost.net>
parents:
37
diff
changeset
|
241 |
-- IN-BAND BYTESTREAMS (XEP-0047) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
242 |
-- Implemented in C in streams module |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
243 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
244 |
-- require 'ibb' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
245 |
|
62 | 246 |
-- VCARD-TEMP (XEP-0054) |
247 |
||
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
248 |
require 'vcard' |
62 | 249 |
|
23
e441162b1386
One pep handler, pep commands
Myhailo Danylenko <isbear@ukrpost.net>
parents:
21
diff
changeset
|
250 |
-- PUBLISH-SUBSRIBE (XEP-0060) |
21 | 251 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
252 |
require 'pubsub' |
21 | 253 |
|
37 | 254 |
-- OUT OF BAND DATA (XEP-0066) |
255 |
||
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
256 |
require 'oob' |
37 | 257 |
|
62 | 258 |
-- MALICIOUS STANZAS (XEP-0076) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
259 |
-- Well, that's joke XEP and joke module |
62 | 260 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
261 |
-- require 'evil' |
62 | 262 |
|
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
263 |
-- IN-BAND REGISTRATION (XEP-0077) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
264 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
265 |
require 'register' |
57 | 266 |
|
59 | 267 |
-- USER LOCATION (XEP-0080) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
268 |
-- Implemented in C in geoloc module |
59 | 269 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
270 |
-- require 'geoloc' |
59 | 271 |
|
57 | 272 |
-- USER AVATAR (XEP-0084) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
273 |
-- Implemented in C in avatar module |
57 | 274 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
275 |
-- require 'avatar' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
276 |
|
59 | 277 |
-- USER MOOD (XEP-0107) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
278 |
-- Implemented in C in mood module |
59 | 279 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
280 |
-- require 'mood' |
59 | 281 |
|
282 |
-- USER ACTIVITY (XEP-0108) |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
283 |
-- Implemented in C in activity module |
59 | 284 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
285 |
-- require 'activity' |
59 | 286 |
|
287 |
-- USER TUNE (XEP-0118) |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
288 |
-- Implemented in C in tune module |
59 | 289 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
290 |
-- require 'tune' |
59 | 291 |
|
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
292 |
-- REMOTE CONTROLLING CLIENTS (XEP-0146) |
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
293 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
294 |
require 'remote' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
295 |
|
23
e441162b1386
One pep handler, pep commands
Myhailo Danylenko <isbear@ukrpost.net>
parents:
21
diff
changeset
|
296 |
-- PERSONAL EVENTING PROTOCOL (XEP-0163) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
297 |
-- Implemented in C in pep module |
23
e441162b1386
One pep handler, pep commands
Myhailo Danylenko <isbear@ukrpost.net>
parents:
21
diff
changeset
|
298 |
|
57 | 299 |
-- XMPP PING (XEP-0199) |
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
300 |
-- Included into upstream as /request ping |
57 | 301 |
|
99
ed4676536ed9
Update most useful scripts
Myhailo Danylenko <isbear@ukrpost.net>
parents:
84
diff
changeset
|
302 |
-- require 'ping' |
23
e441162b1386
One pep handler, pep commands
Myhailo Danylenko <isbear@ukrpost.net>
parents:
21
diff
changeset
|
303 |
|
50 | 304 |
-- ATTENTION (XEP-0224) |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
305 |
|
68
742878c74b8e
Lm separation, privacy
Myhailo Danylenko <isbear@ukrpost.net>
parents:
67
diff
changeset
|
306 |
require 'attention' |
5
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
307 |
|
cba039bd6f13
Included sample configuration into package
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff
changeset
|
308 |
-- The End -- vim: se ts=4: -- |