115 end |
115 end |
116 end |
116 end |
117 |
117 |
118 -- COMMANDS |
118 -- COMMANDS |
119 |
119 |
120 -- Help strings should not contain command, only arguments. This is necessary to support soft aliases. |
120 --[[ Help strings should not contain command, only arguments. This is necessary to support soft aliases. |
121 commands_help = { |
121 commands_help = { |
122 post = "filename\n\nSends file as a message. Just shorthand.", |
122 post = "filename\n\nSends file as a message. Just shorthand.", |
123 beep = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables beeping on all messages.\nIf state is omitted, prints current state.", |
123 beep = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables beeping on all messages.\nIf state is omitted, prints current state.", |
124 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", |
124 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", |
125 exthelp = "[command]\n\nPrints help for a given command, or list of available help topics.", |
125 exthelp = "[command]\n\nPrints help for a given command, or list of available help topics.", |
126 ['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.", |
126 ['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.", |
127 count = "\n\nPrints number of resources of current buddy. Useful to determine member count of large room.", |
127 count = "\n\nPrints number of resources of current buddy. Useful to determine member count of large room.", |
128 toggle = "\n\nToggles away/online status.", |
128 toggle = "\n\nToggles away/online status.", |
129 } |
129 } |
|
130 --]] |
130 |
131 |
131 main.command ( 'post', |
132 main.command ( 'post', |
132 function ( args ) |
133 function ( args ) |
133 main.run ( 'say_to -f ' .. args .. ' .' ) |
134 main.run ( 'say_to -f ' .. args .. ' .' ) |
134 end, false, 'filename' ) |
135 end, false, 'filename' ) |
|
136 --[[ |
135 main.command ( 'cmd', |
137 main.command ( 'cmd', |
136 function ( args ) |
138 function ( args ) |
137 local to = main.current_buddy () |
139 local to = main.current_buddy () |
138 main.run ( ('say_to -q %q $ %s'):format ( to, args ) ) |
140 main.run ( ('say_to -q %q $ %s'):format ( to, args ) ) |
139 main.bgread ( args, |
141 main.bgread ( args, |
170 for resource in pairs ( main.buddy_info ( main.current_buddy () ).resources ) do |
172 for resource in pairs ( main.buddy_info ( main.current_buddy () ).resources ) do |
171 count = count + 1 |
173 count = count + 1 |
172 end |
174 end |
173 print ( "Resource count: " .. count ) |
175 print ( "Resource count: " .. count ) |
174 end ) |
176 end ) |
|
177 --]] |
175 main.command ( 'toggle', |
178 main.command ( 'toggle', |
176 function ( args ) |
179 function ( args ) |
177 local stat, mess = main.status () |
180 local stat, mess = main.status () |
178 if stat == 'o' then |
181 if stat == 'o' then |
179 main.run ( 'status away ' .. mess ) |
182 main.run ( 'status away ' .. mess ) |