1 | #include <stdio.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include <string.h> |
---|
4 | #include <unistd.h> |
---|
5 | #include "owl.h" |
---|
6 | |
---|
7 | /* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */ |
---|
8 | #define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \ |
---|
9 | { name, summary, usage, description, ctx, \ |
---|
10 | NULL, fn, NULL, NULL, NULL, NULL, NULL, NULL } |
---|
11 | |
---|
12 | /* fn is "void foo(void)" */ |
---|
13 | #define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \ |
---|
14 | { name, summary, usage, description, ctx, \ |
---|
15 | NULL, NULL, fn, NULL, NULL, NULL, NULL, NULL } |
---|
16 | |
---|
17 | /* fn is "void foo(int)" */ |
---|
18 | #define OWLCMD_INT(name, fn, ctx, summary, usage, description) \ |
---|
19 | { name, summary, usage, description, ctx, \ |
---|
20 | NULL, NULL, NULL, fn, NULL, NULL, NULL, NULL } |
---|
21 | |
---|
22 | #define OWLCMD_ALIAS(name, actualname) \ |
---|
23 | { name, OWL_CMD_ALIAS_SUMMARY_PREFIX actualname, "", "", OWL_CTX_ANY, \ |
---|
24 | actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL } |
---|
25 | |
---|
26 | /* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */ |
---|
27 | #define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \ |
---|
28 | { name, summary, usage, description, ctx, \ |
---|
29 | NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL } |
---|
30 | |
---|
31 | /* fn is "void foo(void)" */ |
---|
32 | #define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \ |
---|
33 | { name, summary, usage, description, ctx, \ |
---|
34 | NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL, NULL } |
---|
35 | |
---|
36 | /* fn is "void foo(int)" */ |
---|
37 | #define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \ |
---|
38 | { name, summary, usage, description, ctx, \ |
---|
39 | NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn), NULL } |
---|
40 | |
---|
41 | |
---|
42 | const owl_cmd commands_to_init[] |
---|
43 | = { |
---|
44 | OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY, |
---|
45 | "send a login or logout notification", |
---|
46 | "zlog in [tty]\nzlog out", |
---|
47 | "zlog in will send a login notification, zlog out will send a\n" |
---|
48 | "logout notification. By default a login notification is sent\n" |
---|
49 | "when owl is started and a logout notification is sent when owl\n" |
---|
50 | "is exited. This behavior can be changed with the 'startuplogin'\n" |
---|
51 | "and 'shutdownlogout' variables. If a tty is specified for zlog in\n" |
---|
52 | "then the owl variable 'tty' will be set to that string, causing\n" |
---|
53 | "it to be used as the zephyr location tty.\n"), |
---|
54 | |
---|
55 | OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY, |
---|
56 | "exit owl", |
---|
57 | "", |
---|
58 | "Exit owl and run any shutdown activities."), |
---|
59 | OWLCMD_ALIAS("exit", "quit"), |
---|
60 | OWLCMD_ALIAS("q", "quit"), |
---|
61 | |
---|
62 | OWLCMD_ARGS("term", owl_command_term, OWL_CTX_ANY, |
---|
63 | "control the terminal", |
---|
64 | "term raise\n" |
---|
65 | "term deiconify\n", |
---|
66 | ""), |
---|
67 | |
---|
68 | OWLCMD_VOID("nop", owl_command_nop, OWL_CTX_ANY, |
---|
69 | "do nothing", |
---|
70 | "", |
---|
71 | ""), |
---|
72 | |
---|
73 | OWLCMD_ARGS("start-command", owl_command_start_command, OWL_CTX_INTERACTIVE, |
---|
74 | "prompts the user to enter a command", |
---|
75 | "start-command [initial-value]", |
---|
76 | "Initializes the command field to initial-value."), |
---|
77 | |
---|
78 | OWLCMD_ARGS("alias", owl_command_alias, OWL_CTX_ANY, |
---|
79 | "creates a command alias", |
---|
80 | "alias <new_command> <old_command>", |
---|
81 | "Creates a command alias from new_command to old_command.\n" |
---|
82 | "Any arguments passed to <new_command> will be appended to\n" |
---|
83 | "<old_command> before it is executed.\n"), |
---|
84 | |
---|
85 | OWLCMD_ARGS("bindkey", owl_command_bindkey, OWL_CTX_ANY, |
---|
86 | "creates a binding in a keymap", |
---|
87 | "bindkey <keymap> <keyseq> command <command>", |
---|
88 | "(Note: There is a literal word \"command\" between <keyseq>\n" |
---|
89 | " and <command>.)\n" |
---|
90 | "Binds a key sequence to a command within a keymap.\n" |
---|
91 | "Use 'show keymaps' to see the existing keymaps.\n" |
---|
92 | "Key sequences may be things like M-C-t or NPAGE.\n\n" |
---|
93 | "Ex.: bindkey recv C-b command zwrite -c barnowl"), |
---|
94 | |
---|
95 | OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE, |
---|
96 | "send a zephyr", |
---|
97 | "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [<user> ...] [-m <message...>]", |
---|
98 | "Zwrite send a zephyr to the one or more users specified.\n\n" |
---|
99 | "The following options are available:\n\n" |
---|
100 | "-m Specifies a message to send without prompting.\n" |
---|
101 | " Note that this does not yet log an outgoing message.\n" |
---|
102 | " This must be the last argument.\n\n" |
---|
103 | "-n Do not send a ping message.\n\n" |
---|
104 | "-C If the message is sent to more than one user include a\n" |
---|
105 | " \"cc:\" line in the text\n\n" |
---|
106 | "-c class\n" |
---|
107 | " Send to the specified zephyr class\n\n" |
---|
108 | "-i instance\n" |
---|
109 | " Send to the specified zephyr instance\n\n" |
---|
110 | "-r realm\n" |
---|
111 | " Send to a foreign realm\n" |
---|
112 | "-O opcode\n" |
---|
113 | " Send to the specified opcode\n"), |
---|
114 | |
---|
115 | OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE, |
---|
116 | "send an AIM message", |
---|
117 | "aimwrite <user> [-m <message...>]", |
---|
118 | "Send an aim message to a user.\n\n" |
---|
119 | "The following options are available:\n\n" |
---|
120 | "-m Specifies a message to send without prompting.\n"), |
---|
121 | |
---|
122 | OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE, |
---|
123 | "send a loopback message", |
---|
124 | "loopwrite", |
---|
125 | "Send a local message.\n"), |
---|
126 | |
---|
127 | OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE, |
---|
128 | "send an encrypted zephyr", |
---|
129 | "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [-m <message...>]\n", |
---|
130 | "Behaves like zwrite but uses encryption. Not for use with\n" |
---|
131 | "personal messages\n"), |
---|
132 | |
---|
133 | OWLCMD_ARGS("reply", owl_command_reply, OWL_CTX_INTERACTIVE, |
---|
134 | "reply to the current message", |
---|
135 | "reply [-e] [ sender | all | zaway ]", |
---|
136 | "If -e is specified, the zwrite command line is presented to\n" |
---|
137 | "allow editing.\n\n" |
---|
138 | "If 'sender' is specified, reply to the sender.\n\n" |
---|
139 | "If 'all' or no args are specified, reply publically to the\n" |
---|
140 | "same class/instance for non-personal messages and to the\n" |
---|
141 | "sender for personal messages.\n\n" |
---|
142 | "If 'zaway' is specified, replies with a zaway message.\n\n"), |
---|
143 | |
---|
144 | OWLCMD_ARGS("set", owl_command_set, OWL_CTX_ANY, |
---|
145 | "set a variable value", |
---|
146 | "set [-q] [<variable>] [<value>]\n" |
---|
147 | "set", |
---|
148 | "Set the named variable to the specified value. If no\n" |
---|
149 | "arguments are given, print the value of all variables.\n" |
---|
150 | "If the value is unspecified and the variable is a boolean, it will be\n" |
---|
151 | "set to 'on'. If -q is used, set is silent and does not print a\n" |
---|
152 | "message.\n"), |
---|
153 | |
---|
154 | OWLCMD_ARGS("unset", owl_command_unset, OWL_CTX_ANY, |
---|
155 | "unset a boolean variable value", |
---|
156 | "unset [-q] <variable>\n" |
---|
157 | "unset", |
---|
158 | "Set the named boolean variable to off.\n" |
---|
159 | "If -q is specified, is silent and doesn't print a message.\n"), |
---|
160 | |
---|
161 | OWLCMD_ARGS("print", owl_command_print, OWL_CTX_ANY, |
---|
162 | "print a variable value", |
---|
163 | "print <variable>\n" |
---|
164 | "print", |
---|
165 | "Print the value of the named variable. If no arguments\n" |
---|
166 | "are used print the value of all variables.\n"), |
---|
167 | |
---|
168 | OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY, |
---|
169 | "run a command and set it to be run at every Owl startup", |
---|
170 | "startup <commands> ...", |
---|
171 | "Everything on the command line after the startup command\n" |
---|
172 | "is executed as a normal owl command and is also placed in\n" |
---|
173 | "a file so that the command is executed every time owl\n" |
---|
174 | "is started"), |
---|
175 | |
---|
176 | OWLCMD_ARGS("unstartup", owl_command_unstartup, OWL_CTX_ANY, |
---|
177 | "remove a command from the list of those to be run at Owl startup", |
---|
178 | "unstartup <commands> ...", |
---|
179 | ""), |
---|
180 | |
---|
181 | OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY, |
---|
182 | "print the version of the running owl", "", ""), |
---|
183 | |
---|
184 | OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY, |
---|
185 | "subscribe to a zephyr class, instance, recipient", |
---|
186 | "subscribe [-t] <class> [instance [recipient]]", |
---|
187 | "Subscribe to the specified class and instance. If the\n" |
---|
188 | "instance or recipient is not listed on the command\n" |
---|
189 | "line they default to * (the wildcard recipient).\n" |
---|
190 | "If the -t option is present the subscription will\n" |
---|
191 | "only be temporary, i.e., it will not be written to\n" |
---|
192 | "the subscription file and will therefore not be\n" |
---|
193 | "present the next time owl is started.\n"), |
---|
194 | OWLCMD_ALIAS("sub", "subscribe"), |
---|
195 | |
---|
196 | OWLCMD_ARGS("unsubscribe", owl_command_unsubscribe, OWL_CTX_ANY, |
---|
197 | "unsubscribe from a zephyr class, instance, recipient", |
---|
198 | "unsubscribe [-t] <class> [instance [recipient]]", |
---|
199 | "Unsubscribe from the specified class and instance. If the\n" |
---|
200 | "instance or recipient is not listed on the command\n" |
---|
201 | "line they default to * (the wildcard recipient).\n" |
---|
202 | "If the -t option is present the unsubscription will\n" |
---|
203 | "only be temporary, i.e., it will not be updated in\n" |
---|
204 | "the subscription file and will therefore not be\n" |
---|
205 | "in effect the next time owl is started.\n"), |
---|
206 | OWLCMD_ALIAS("unsub", "unsubscribe"), |
---|
207 | |
---|
208 | OWLCMD_VOID("unsuball", owl_command_unsuball, OWL_CTX_ANY, |
---|
209 | "unsubscribe from all zephyrs", "", ""), |
---|
210 | |
---|
211 | OWLCMD_VOID("getsubs", owl_command_getsubs, OWL_CTX_ANY, |
---|
212 | "print all current subscriptions", |
---|
213 | "getsubs", |
---|
214 | "getsubs retrieves the current subscriptions from the server\n" |
---|
215 | "and displays them.\n"), |
---|
216 | |
---|
217 | OWLCMD_ARGS("dump", owl_command_dump, OWL_CTX_ANY, |
---|
218 | "dump messages to a file", |
---|
219 | "dump <filename>", |
---|
220 | "Dump messages in current view to the named file."), |
---|
221 | |
---|
222 | OWLCMD_ARGS("source", owl_command_source, OWL_CTX_ANY, |
---|
223 | "execute owl commands from a file", |
---|
224 | "source <filename>", |
---|
225 | "Execute the owl commands in <filename>.\n"), |
---|
226 | |
---|
227 | OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE, |
---|
228 | "AIM specific commands", |
---|
229 | "aim search <email>", |
---|
230 | ""), |
---|
231 | |
---|
232 | OWLCMD_ARGS("addbuddy", owl_command_addbuddy, OWL_CTX_INTERACTIVE, |
---|
233 | "add a buddy to a buddylist", |
---|
234 | "addbuddy <protocol> <screenname>", |
---|
235 | "Add the named buddy to your buddylist. <protocol> can be aim or zephyr\n"), |
---|
236 | |
---|
237 | OWLCMD_ARGS("delbuddy", owl_command_delbuddy, OWL_CTX_INTERACTIVE, |
---|
238 | "delete a buddy from a buddylist", |
---|
239 | "delbuddy <protocol> <screenname>", |
---|
240 | "Delete the named buddy from your buddylist. <protocol> can be aim or zephyr\n"), |
---|
241 | |
---|
242 | OWLCMD_ARGS("join", owl_command_join, OWL_CTX_INTERACTIVE, |
---|
243 | "join a chat group", |
---|
244 | "join aim <groupname> [exchange]", |
---|
245 | "Join the AIM chatroom with 'groupname'.\n"), |
---|
246 | |
---|
247 | OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE, |
---|
248 | "creates a zpunt based on the current message", |
---|
249 | "smartzpunt [-i | --instance]", |
---|
250 | "Starts a zpunt command based on the current message's class\n" |
---|
251 | "(and instance if -i is specified).\n"), |
---|
252 | |
---|
253 | OWLCMD_ARGS("zpunt", owl_command_zpunt, OWL_CTX_ANY, |
---|
254 | "suppress a given zephyr triplet", |
---|
255 | "zpunt <class> <instance> [recipient]\n" |
---|
256 | "zpunt <instance>", |
---|
257 | "The zpunt command will supress message to the specified\n" |
---|
258 | "zephyr triplet. In the second usage messages are suppressed\n" |
---|
259 | "for class MESSAGE and the named instance.\n\n" |
---|
260 | "SEE ALSO: zunpunt, show zpunts\n"), |
---|
261 | |
---|
262 | OWLCMD_ARGS("zunpunt", owl_command_zunpunt, OWL_CTX_ANY, |
---|
263 | "undo a previous zpunt", |
---|
264 | "zunpunt <class> <instance> [recipient]\n" |
---|
265 | "zunpunt <instance>", |
---|
266 | "The zunpunt command will allow messages that were previously\n" |
---|
267 | "suppressed to be received again.\n\n" |
---|
268 | "SEE ALSO: zpunt, show zpunts\n"), |
---|
269 | |
---|
270 | OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY, |
---|
271 | "suppress an arbitrary filter", |
---|
272 | "punt <filter-text>", |
---|
273 | "punt <filter-text (multiple words)>\n" |
---|
274 | "The punt command will supress message to the specified\n" |
---|
275 | "filter\n\n" |
---|
276 | "SEE ALSO: unpunt, zpunt, show zpunts\n"), |
---|
277 | |
---|
278 | OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY, |
---|
279 | "remove an entry from the punt list", |
---|
280 | "zpunt <filter-text>\n" |
---|
281 | "zpunt <filter-text>\n" |
---|
282 | "zpunt <number>\n", |
---|
283 | "The unpunt command will remove an entry from the puntlist.\n" |
---|
284 | "The first two forms correspond to the first two forms of the :punt\n" |
---|
285 | "command. The latter allows you to remove a specific entry from the\n" |
---|
286 | "the list (see :show zpunts)\n\n" |
---|
287 | "SEE ALSO: punt, zpunt, zunpunt, show zpunts\n"), |
---|
288 | |
---|
289 | OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE, |
---|
290 | "display detailed information about the current message", |
---|
291 | "", ""), |
---|
292 | |
---|
293 | OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE, |
---|
294 | "display help on using owl", |
---|
295 | "help [command]", ""), |
---|
296 | |
---|
297 | OWLCMD_ARGS("zlist", owl_command_zlist, OWL_CTX_INTERACTIVE, |
---|
298 | "List users logged in", |
---|
299 | "znol [-f file]", |
---|
300 | "Print a znol-style listing of users logged in"), |
---|
301 | |
---|
302 | OWLCMD_VOID("alist", owl_command_alist, OWL_CTX_INTERACTIVE, |
---|
303 | "List AIM users logged in", |
---|
304 | "alist", |
---|
305 | "Print a listing of AIM users logged in"), |
---|
306 | |
---|
307 | OWLCMD_VOID("blist", owl_command_blist, OWL_CTX_INTERACTIVE, |
---|
308 | "List all buddies logged in", |
---|
309 | "blist", |
---|
310 | "Print a listing of buddies logged in, regardless of protocol."), |
---|
311 | |
---|
312 | OWLCMD_VOID("toggle-oneline", owl_command_toggleoneline, OWL_CTX_INTERACTIVE, |
---|
313 | "Toggle the style between oneline and the default style", |
---|
314 | "toggle-oneline", |
---|
315 | ""), |
---|
316 | |
---|
317 | OWLCMD_ARGS("recv:getshift", owl_command_get_shift, OWL_CTX_INTERACTIVE, |
---|
318 | "gets position of receive window scrolling", "", ""), |
---|
319 | |
---|
320 | OWLCMD_INT("recv:setshift", owl_command_set_shift, OWL_CTX_INTERACTIVE, |
---|
321 | "scrolls receive window to specified position", "", ""), |
---|
322 | |
---|
323 | OWLCMD_VOID("recv:pagedown", owl_function_mainwin_pagedown, |
---|
324 | OWL_CTX_INTERACTIVE, |
---|
325 | "scrolls down by a page", "", ""), |
---|
326 | |
---|
327 | OWLCMD_VOID("recv:pageup", owl_function_mainwin_pageup, OWL_CTX_INTERACTIVE, |
---|
328 | "scrolls up by a page", "", ""), |
---|
329 | |
---|
330 | OWLCMD_VOID("recv:mark", owl_function_mark_message, |
---|
331 | OWL_CTX_INTERACTIVE, |
---|
332 | "mark the current message", "", ""), |
---|
333 | |
---|
334 | OWLCMD_VOID("recv:swapmark", owl_function_swap_cur_marked, |
---|
335 | OWL_CTX_INTERACTIVE, |
---|
336 | "swap the positions of the pointer and the mark", "", ""), |
---|
337 | |
---|
338 | OWLCMD_INT ("recv:scroll", owl_function_page_curmsg, OWL_CTX_INTERACTIVE, |
---|
339 | "scrolls current message up or down", |
---|
340 | "recv:scroll <numlines>", |
---|
341 | "Scrolls the current message up or down by <numlines>.\n" |
---|
342 | "Scrolls up if <numlines> is negative, else scrolls down.\n"), |
---|
343 | |
---|
344 | OWLCMD_ARGS("next", owl_command_next, OWL_CTX_INTERACTIVE, |
---|
345 | "move the pointer to the next message", |
---|
346 | "recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]\n" |
---|
347 | " [ --smart-filter | --smart-filter-instance ]", |
---|
348 | "Moves the pointer to the next message in the current view.\n" |
---|
349 | "If --filter is specified, will only consider messages in\n" |
---|
350 | "the filter <name>.\n" |
---|
351 | "If --smart-filter or --smart-filter-instance is specified,\n" |
---|
352 | "goes to the next message that is similar to the current message.\n" |
---|
353 | "If --skip-deleted is specified, deleted messages will\n" |
---|
354 | "be skipped.\n" |
---|
355 | "If --last-if-none is specified, will stop at last message\n" |
---|
356 | "in the view if no other suitable messages are found.\n"), |
---|
357 | OWLCMD_ALIAS("recv:next", "next"), |
---|
358 | |
---|
359 | OWLCMD_ARGS("prev", owl_command_prev, OWL_CTX_INTERACTIVE, |
---|
360 | "move the pointer to the previous message", |
---|
361 | "recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]\n" |
---|
362 | " [ --smart-filter | --smart-filter-instance ]", |
---|
363 | "Moves the pointer to the next message in the current view.\n" |
---|
364 | "If --filter is specified, will only consider messages in\n" |
---|
365 | "the filter <name>.\n" |
---|
366 | "If --smart-filter or --smart-filter-instance is specified,\n" |
---|
367 | "goes to the previous message that is similar to the current message.\n" |
---|
368 | "If --skip-deleted is specified, deleted messages will\n" |
---|
369 | "be skipped.\n" |
---|
370 | "If --first-if-none is specified, will stop at first message\n" |
---|
371 | "in the view if no other suitable messages are found.\n"), |
---|
372 | OWLCMD_ALIAS("recv:prev", "prev"), |
---|
373 | |
---|
374 | OWLCMD_ALIAS("recv:next-notdel", "recv:next --skip-deleted --last-if-none"), |
---|
375 | OWLCMD_ALIAS("next-notdel", "recv:next --skip-deleted --last-if-none"), |
---|
376 | |
---|
377 | OWLCMD_ALIAS("recv:prev-notdel", "recv:prev --skip-deleted --first-if-none"), |
---|
378 | OWLCMD_ALIAS("prev-notdel", "recv:prev --skip-deleted --first-if-none"), |
---|
379 | |
---|
380 | OWLCMD_ALIAS("recv:next-personal", "recv:next --filter personal"), |
---|
381 | |
---|
382 | OWLCMD_ALIAS("recv:prev-personal", "recv:prev --filter personal"), |
---|
383 | |
---|
384 | OWLCMD_VOID("first", owl_command_first, OWL_CTX_INTERACTIVE, |
---|
385 | "move the pointer to the first message", "", ""), |
---|
386 | OWLCMD_ALIAS("recv:first", "first"), |
---|
387 | |
---|
388 | OWLCMD_VOID("last", owl_command_last, OWL_CTX_INTERACTIVE, |
---|
389 | "move the pointer to the last message", "", |
---|
390 | "Moves the pointer to the last message in the view.\n" |
---|
391 | "If we are already at the last message in the view,\n" |
---|
392 | "blanks the screen and moves just past the end of the view\n" |
---|
393 | "so that new messages will appear starting at the top\n" |
---|
394 | "of the screen.\n"), |
---|
395 | OWLCMD_ALIAS("recv:last", "last"), |
---|
396 | |
---|
397 | OWLCMD_VOID("expunge", owl_command_expunge, OWL_CTX_INTERACTIVE, |
---|
398 | "remove all messages marked for deletion", "", ""), |
---|
399 | |
---|
400 | OWLCMD_VOID("resize", owl_command_resize, OWL_CTX_ANY, |
---|
401 | "resize the window to the current screen size", "", ""), |
---|
402 | |
---|
403 | OWLCMD_VOID("redisplay", owl_command_redisplay, OWL_CTX_ANY, |
---|
404 | "redraw the entire window", "", ""), |
---|
405 | |
---|
406 | OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY, |
---|
407 | "suspend owl", "", ""), |
---|
408 | |
---|
409 | OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY, |
---|
410 | "pops up a message in popup window", |
---|
411 | "echo [args .. ]\n\n", ""), |
---|
412 | |
---|
413 | OWLCMD_ARGS("exec", owl_command_exec, OWL_CTX_ANY, |
---|
414 | "run a command from the shell", |
---|
415 | "exec [args .. ]", ""), |
---|
416 | |
---|
417 | OWLCMD_ARGS("aexec", owl_command_aexec, OWL_CTX_INTERACTIVE, |
---|
418 | "run a command from the shell and display in an admin message", |
---|
419 | "aexec [args .. ]", ""), |
---|
420 | |
---|
421 | OWLCMD_ARGS("pexec", owl_command_pexec, OWL_CTX_INTERACTIVE, |
---|
422 | "run a command from the shell and display in a popup window", |
---|
423 | "pexec [args .. ]", ""), |
---|
424 | |
---|
425 | OWLCMD_ARGS("perl", owl_command_perl, OWL_CTX_ANY, |
---|
426 | "run a perl expression", |
---|
427 | "perl [args .. ]", ""), |
---|
428 | |
---|
429 | OWLCMD_ARGS("aperl", owl_command_aperl, OWL_CTX_INTERACTIVE, |
---|
430 | "run a perl expression and display in an admin message", |
---|
431 | "aperl [args .. ]", ""), |
---|
432 | |
---|
433 | OWLCMD_ARGS("pperl", owl_command_pperl, OWL_CTX_INTERACTIVE, |
---|
434 | "run a perl expression and display in a popup window", |
---|
435 | "pperl [args .. ]", ""), |
---|
436 | |
---|
437 | OWLCMD_ARGS("multi", owl_command_multi, OWL_CTX_ANY, |
---|
438 | "runs multiple ;-separated commands", |
---|
439 | "multi <command1> ( ; <command2> )*\n", |
---|
440 | "Runs multiple semicolon-separated commands in order.\n" |
---|
441 | "Note quoting isn't supported here yet.\n" |
---|
442 | "If you want to do something fancy, use perl.\n"), |
---|
443 | |
---|
444 | OWLCMD_ARGS("(", owl_command_multi, OWL_CTX_ANY, |
---|
445 | "runs multiple ;-separated commands", |
---|
446 | "'(' <command1> ( ; <command2> )* ')'\n", |
---|
447 | "Runs multiple semicolon-separated commands in order.\n" |
---|
448 | "You must have a space before the final ')'\n" |
---|
449 | "Note quoting isn't supported here yet.\n" |
---|
450 | "If you want to do something fancy, use perl.\n"), |
---|
451 | |
---|
452 | OWLCMD_VOID("pop-message", owl_command_pop_message, OWL_CTX_RECWIN, |
---|
453 | "pops up a message in a window", "", ""), |
---|
454 | |
---|
455 | OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE, |
---|
456 | "Set, enable or disable zephyr away message", |
---|
457 | "zaway [ on | off | toggle ]\n" |
---|
458 | "zaway <message>", |
---|
459 | "Turn on or off a zaway message. If 'message' is\n" |
---|
460 | "specified turn on zaway with that message, otherwise\n" |
---|
461 | "use the default.\n"), |
---|
462 | |
---|
463 | OWLCMD_ARGS("aaway", owl_command_aaway, OWL_CTX_INTERACTIVE, |
---|
464 | "Set, enable or disable AIM away message", |
---|
465 | "aaway [ on | off | toggle ]\n" |
---|
466 | "aaway <message>", |
---|
467 | "Turn on or off the AIM away message. If 'message' is\n" |
---|
468 | "specified turn on aaway with that message, otherwise\n" |
---|
469 | "use the default.\n"), |
---|
470 | |
---|
471 | OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE, |
---|
472 | "Set, enable or disable both AIM and zephyr away messages", |
---|
473 | "away [ on | off | toggle ]\n" |
---|
474 | "away <message>", |
---|
475 | "Turn on or off the AIM and zephyr away message. If\n" |
---|
476 | "'message' is specified turn them on with that message,\n" |
---|
477 | "otherwise use the default.\n" |
---|
478 | "\n" |
---|
479 | "This command really just runs the 'aaway' and 'zaway'\n" |
---|
480 | "commands together\n" |
---|
481 | "\n" |
---|
482 | "SEE ALSO: aaway, zaway"), |
---|
483 | |
---|
484 | OWLCMD_ARGS("load-subs", owl_command_loadsubs, OWL_CTX_ANY, |
---|
485 | "load subscriptions from a file", |
---|
486 | "load-subs <file>\n", ""), |
---|
487 | |
---|
488 | OWLCMD_ARGS("loadsubs", owl_command_loadsubs, OWL_CTX_ANY, |
---|
489 | "load subscriptions from a file", |
---|
490 | "loadsubs <file>\n", ""), |
---|
491 | |
---|
492 | OWLCMD_ARGS("loadloginsubs", owl_command_loadloginsubs, OWL_CTX_ANY, |
---|
493 | "load login subscriptions from a file", |
---|
494 | "loadloginsubs <file>\n", |
---|
495 | "The file should contain a list of usernames, one per line."), |
---|
496 | |
---|
497 | OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE, |
---|
498 | "print information about owl", "", ""), |
---|
499 | |
---|
500 | OWLCMD_VOID("status", owl_command_status, OWL_CTX_ANY, |
---|
501 | "print status information about the running owl", "", ""), |
---|
502 | |
---|
503 | OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE, |
---|
504 | "locate a user", |
---|
505 | "zlocate [-d] <user> ...", |
---|
506 | "Performs a zlocate on one ore more users and puts the result\n" |
---|
507 | "int a popwin. If -d is specified, does not authenticate\n" |
---|
508 | "the lookup request.\n"), |
---|
509 | |
---|
510 | OWLCMD_ARGS("filter", owl_command_filter, OWL_CTX_ANY, |
---|
511 | "create a message filter", |
---|
512 | "filter <name> [ -c fgcolor ] [ -b bgcolor ] [ <expression> ... ]", |
---|
513 | "The filter command creates a filter with the specified name,\n" |
---|
514 | "or if one already exists it is replaced. Example filter\n" |
---|
515 | "syntax would be:\n\n" |
---|
516 | " filter myfilter -c red ( class ^foobar$ ) or ( class ^quux$ and instance ^bar$ )\n\n" |
---|
517 | "Valid matching fields are:\n" |
---|
518 | " sender - sender\n" |
---|
519 | " recipient - recipient\n" |
---|
520 | " class - zephyr class name\n" |
---|
521 | " instance - zephyr instance name\n" |
---|
522 | " opcode - zephyr opcode\n" |
---|
523 | " realm - zephyr realm\n" |
---|
524 | " body - message body\n" |
---|
525 | " hostname - hostname of sending host\n" |
---|
526 | " type - message type (zephyr, aim, admin)\n" |
---|
527 | " direction - either 'in' 'out' or 'none'\n" |
---|
528 | " login - either 'login' 'logout' or 'none'\n" |
---|
529 | "Also you may match on the validity of another filter:\n" |
---|
530 | " filter <filtername>\n" |
---|
531 | "Also you may pass the message to a perl function returning 0 or 1,\n" |
---|
532 | "where 1 indicates that the function matches the filter:\n" |
---|
533 | " perl <subname>\n" |
---|
534 | "Valid operators are:\n" |
---|
535 | " and\n" |
---|
536 | " or\n" |
---|
537 | " not\n" |
---|
538 | "And additionally you may use the static values:\n" |
---|
539 | " true\n" |
---|
540 | " false\n" |
---|
541 | "Spaces must be present before and after parentheses. If the\n" |
---|
542 | "optional color arguments are used they specifies the colors that\n" |
---|
543 | "messages matching this filter should be displayed in.\n\n" |
---|
544 | "SEE ALSO: view, viewclass, viewuser\n"), |
---|
545 | |
---|
546 | OWLCMD_ARGS("colorview", owl_command_colorview, OWL_CTX_INTERACTIVE, |
---|
547 | "change the colors on the current filter", |
---|
548 | "colorview <fgcolor> [<bgcolor>]", |
---|
549 | "The colors of messages in the current filter will be changed\n" |
---|
550 | "to <fgcolor>,<bgcolor>. Use the 'show colors' command for a list\n" |
---|
551 | "of valid colors.\n\n" |
---|
552 | "SEE ALSO: 'show colors'\n"), |
---|
553 | |
---|
554 | OWLCMD_ARGS("colorclass", owl_command_colorclass, OWL_CTX_INTERACTIVE, |
---|
555 | "create a filter to color messages of the given class name", |
---|
556 | "colorclass <class> <fgcolor> [<bgcolor>]", |
---|
557 | "A filter will be created to color messages in <class>" |
---|
558 | "in <fgcolor>,<bgcolor>. Use the 'show colors' command for a list\n" |
---|
559 | "of valid colors.\n\n" |
---|
560 | "SEE ALSO: 'show colors'\n"), |
---|
561 | |
---|
562 | OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE, |
---|
563 | "view messages matching a filter", |
---|
564 | "view [<viewname>] [-f <filter> | --home | -r ] [-s <style>]\n" |
---|
565 | "view <filter>\n" |
---|
566 | "view -d <expression>\n" |
---|
567 | "view --home", |
---|
568 | "The view command sets information associated with a particular view,\n" |
---|
569 | "such as view's filter or style. In the first general usage listed\n" |
---|
570 | "above <viewname> is the name of the view to be changed. If not\n" |
---|
571 | "specified the default view 'main' will be used. A filter can be set\n" |
---|
572 | "for the view by listing a named filter after the -f argument. If\n" |
---|
573 | "the --home argument is used the filter will be set to the filter named\n" |
---|
574 | "by the\n 'view_home' variable. The style can be set by listing the\n" |
---|
575 | "name style after the -s argument.\n" |
---|
576 | "\n" |
---|
577 | "The other usages listed above are abbreivated forms that simply set\n" |
---|
578 | "the filter of the current view. The -d option allows you to write a\n" |
---|
579 | "filter expression that will be dynamically created by owl and then\n" |
---|
580 | "applied as the view's filter\n" |
---|
581 | "SEE ALSO: filter, viewclass, viewuser\n"), |
---|
582 | |
---|
583 | OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE, |
---|
584 | "view only messages similar to the current message", |
---|
585 | "smartnarrow [-i | --instance]", |
---|
586 | "If the curmsg is a personal message narrow\n" |
---|
587 | " to the conversation with that user.\n" |
---|
588 | "If the curmsg is a <MESSAGE, foo, *>\n" |
---|
589 | " message, narrow to the instance.\n" |
---|
590 | "If the curmsg is a class message, narrow\n" |
---|
591 | " to the class.\n" |
---|
592 | "If the curmsg is a class message and '-i' is specified\n" |
---|
593 | " then narrow to the class and instance.\n"), |
---|
594 | |
---|
595 | OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE, |
---|
596 | "returns the name of a filter based on the current message", |
---|
597 | "smartfilter [-i | --instance]", |
---|
598 | "If the curmsg is a personal message, the filter is\n" |
---|
599 | " the conversation with that user.\n" |
---|
600 | "If the curmsg is a <MESSAGE, foo, *>\n" |
---|
601 | " message, the filter is to that instance.\n" |
---|
602 | "If the curmsg is a class message, the filter is that class.\n" |
---|
603 | "If the curmsg is a class message and '-i' is specied\n" |
---|
604 | " the filter is to that class and instance.\n"), |
---|
605 | |
---|
606 | OWLCMD_ARGS("viewclass", owl_command_viewclass, OWL_CTX_INTERACTIVE, |
---|
607 | "view messages matching a particular class", |
---|
608 | "viewclass <class>", |
---|
609 | "The viewclass command will automatically create a filter\n" |
---|
610 | "matching the specified class and switch the current view\n" |
---|
611 | "to it.\n\n" |
---|
612 | "SEE ALSO: filter, view, viewuser\n"), |
---|
613 | OWLCMD_ALIAS("vc", "viewclass"), |
---|
614 | |
---|
615 | OWLCMD_ARGS("viewuser", owl_command_viewuser, OWL_CTX_INTERACTIVE, |
---|
616 | "view messages matching a particular user", |
---|
617 | "viewuser <user>", |
---|
618 | "The viewuser command will automatically create a filter\n" |
---|
619 | "matching the specified user and switch the current\n" |
---|
620 | "view to it.\n\n" |
---|
621 | "SEE ALSO: filter, view, viewclass\n"), |
---|
622 | OWLCMD_ALIAS("vu", "viewuser"), |
---|
623 | |
---|
624 | OWLCMD_ARGS("show", owl_command_show, OWL_CTX_INTERACTIVE, |
---|
625 | "show information", |
---|
626 | "show colors\n" |
---|
627 | "show commands\n" |
---|
628 | "show command <command>\n" |
---|
629 | "show errors\n" |
---|
630 | "show filters\n" |
---|
631 | "show filter <filter>\n" |
---|
632 | "show keymaps\n" |
---|
633 | "show keymap <keymap>\n" |
---|
634 | "show license\n" |
---|
635 | "show quickstart\n" |
---|
636 | "show startup\n" |
---|
637 | "show status\n" |
---|
638 | "show styles\n" |
---|
639 | "show subscriptions / show subs\n" |
---|
640 | "show terminal\n" |
---|
641 | "show variables\n" |
---|
642 | "show variable <variable>\n" |
---|
643 | "show version\n" |
---|
644 | "show view [<view>]\n" |
---|
645 | "show zpunts\n", |
---|
646 | |
---|
647 | "Show colors will display a list of valid colors for the\n" |
---|
648 | " terminal." |
---|
649 | "Show filters will list the names of all filters.\n" |
---|
650 | "Show filter <filter> will show the definition of a particular\n" |
---|
651 | " filter.\n\n" |
---|
652 | "Show startup will display the custom startup config\n\n" |
---|
653 | "Show zpunts will show the active zpunt filters.\n\n" |
---|
654 | "Show keymaps will list the names of all keymaps.\n" |
---|
655 | "Show keymap <keymap> will show the key bindings in a keymap.\n\n" |
---|
656 | "Show commands will list the names of all keymaps.\n" |
---|
657 | "Show command <command> will provide information about a command.\n\n" |
---|
658 | "Show styles will list the names of all styles available\n" |
---|
659 | "for formatting messages.\n\n" |
---|
660 | "Show variables will list the names of all variables.\n\n" |
---|
661 | "Show errors will show a list of errors ecountered by Owl.\n\n" |
---|
662 | "SEE ALSO: filter, view, alias, bindkey, help\n"), |
---|
663 | |
---|
664 | OWLCMD_ARGS("delete", owl_command_delete, OWL_CTX_INTERACTIVE, |
---|
665 | "mark a message for deletion", |
---|
666 | "delete [ -id msgid ] [ --no-move ]\n" |
---|
667 | "delete view\n" |
---|
668 | "delete trash", |
---|
669 | "If no message id is specified the current message is marked\n" |
---|
670 | "for deletion. Otherwise the message with the given message\n" |
---|
671 | "id is marked for deletion.\n" |
---|
672 | "If '--no-move' is specified, don't move after deletion.\n" |
---|
673 | "If 'trash' is specified, deletes all trash/auto messages\n" |
---|
674 | "in the current view.\n" |
---|
675 | "If 'view' is specified, deletes all messages in the\n" |
---|
676 | "current view.\n"), |
---|
677 | OWLCMD_ALIAS("del", "delete"), |
---|
678 | |
---|
679 | OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE, |
---|
680 | "unmark a message for deletion", |
---|
681 | "undelete [ -id msgid ] [ --no-move ]\n" |
---|
682 | "undelete view", |
---|
683 | "If no message id is specified the current message is\n" |
---|
684 | "unmarked for deletion. Otherwise the message with the\n" |
---|
685 | "given message id is unmarked for deletion.\n" |
---|
686 | "If '--no-move' is specified, don't move after deletion.\n" |
---|
687 | "If 'view' is specified, undeletes all messages\n" |
---|
688 | "in the current view.\n"), |
---|
689 | OWLCMD_ALIAS("undel", "undelete"), |
---|
690 | |
---|
691 | OWLCMD_VOID("beep", owl_command_beep, OWL_CTX_ANY, |
---|
692 | "ring the terminal bell", |
---|
693 | "beep", |
---|
694 | "Beep will ring the terminal bell.\n" |
---|
695 | "If the variable 'bell' has been\n" |
---|
696 | "set to 'off' this command does nothing.\n"), |
---|
697 | |
---|
698 | OWLCMD_ARGS("debug", owl_command_debug, OWL_CTX_ANY, |
---|
699 | "prints a message into the debug log", |
---|
700 | "debug <message>", ""), |
---|
701 | |
---|
702 | OWLCMD_ARGS("getview", owl_command_getview, OWL_CTX_INTERACTIVE, |
---|
703 | "returns the name of the filter for the current view", |
---|
704 | "", ""), |
---|
705 | |
---|
706 | OWLCMD_ARGS("getvar", owl_command_getvar, OWL_CTX_INTERACTIVE, |
---|
707 | "returns the value of a variable", |
---|
708 | "getvar <varname>", ""), |
---|
709 | |
---|
710 | OWLCMD_ARGS("getfilter", owl_command_getfilter, OWL_CTX_INTERACTIVE, |
---|
711 | "returns the definition of a filter", |
---|
712 | "getfilter <filtername>", ""), |
---|
713 | |
---|
714 | OWLCMD_ARGS("getstyle", owl_command_getstyle, OWL_CTX_INTERACTIVE, |
---|
715 | "returns the name of the style for the current view", |
---|
716 | "", ""), |
---|
717 | |
---|
718 | OWLCMD_ARGS("search", owl_command_search, OWL_CTX_INTERACTIVE, |
---|
719 | "search messages for a particular string", |
---|
720 | "search [-r] [<string>]", |
---|
721 | "The search command will find messages that contain the\n" |
---|
722 | "specified string and move the cursor there. If no string\n" |
---|
723 | "argument is supplied then the previous one is used. By\n" |
---|
724 | "default searches are done forwards; if -r is used the search\n" |
---|
725 | "is performed backwards"), |
---|
726 | |
---|
727 | OWLCMD_ARGS("setsearch", owl_command_setsearch, OWL_CTX_INTERACTIVE, |
---|
728 | "set the search highlight string without searching", |
---|
729 | "setsearch <string>", |
---|
730 | "The setsearch command highlights all occurences of its\n" |
---|
731 | "argument and makes it the default argument for future\n" |
---|
732 | "search commands, but does not move the cursor. With\n" |
---|
733 | "no argument, it makes search highlighting inactive."), |
---|
734 | |
---|
735 | OWLCMD_ARGS("aimlogin", owl_command_aimlogin, OWL_CTX_ANY, |
---|
736 | "login to an AIM account", |
---|
737 | "aimlogin <screenname> [<password>]\n", |
---|
738 | ""), |
---|
739 | |
---|
740 | OWLCMD_ARGS("aimlogout", owl_command_aimlogout, OWL_CTX_ANY, |
---|
741 | "logout from AIM", |
---|
742 | "aimlogout\n", |
---|
743 | ""), |
---|
744 | |
---|
745 | OWLCMD_ARGS("error", owl_command_error, OWL_CTX_ANY, |
---|
746 | "Display an error message", |
---|
747 | "error <message>", |
---|
748 | ""), |
---|
749 | |
---|
750 | OWLCMD_ARGS("message", owl_command_message, OWL_CTX_ANY, |
---|
751 | "Display an informative message", |
---|
752 | "message <message>", |
---|
753 | ""), |
---|
754 | |
---|
755 | OWLCMD_VOID("yes", owl_command_yes, OWL_CTX_RECV, |
---|
756 | "Answer yes to a question", |
---|
757 | "yes", |
---|
758 | ""), |
---|
759 | |
---|
760 | OWLCMD_VOID("no", owl_command_no, OWL_CTX_RECV, |
---|
761 | "Answer no to a question", |
---|
762 | "no", |
---|
763 | ""), |
---|
764 | |
---|
765 | /****************************************************************/ |
---|
766 | /************************* EDIT-SPECIFIC ************************/ |
---|
767 | /****************************************************************/ |
---|
768 | |
---|
769 | OWLCMD_VOID_CTX("edit:move-next-word", owl_editwin_move_to_nextword, |
---|
770 | OWL_CTX_EDIT, |
---|
771 | "moves cursor forward a word", |
---|
772 | "", ""), |
---|
773 | |
---|
774 | OWLCMD_VOID_CTX("edit:move-prev-word", owl_editwin_move_to_previousword, |
---|
775 | OWL_CTX_EDIT, |
---|
776 | "moves cursor backwards a word", |
---|
777 | "", ""), |
---|
778 | |
---|
779 | OWLCMD_VOID_CTX("edit:move-to-buffer-start", owl_editwin_move_to_top, |
---|
780 | OWL_CTX_EDIT, |
---|
781 | "moves cursor to the top left (start) of the buffer", |
---|
782 | "", ""), |
---|
783 | |
---|
784 | OWLCMD_VOID_CTX("edit:move-to-buffer-end", owl_editwin_move_to_end, |
---|
785 | OWL_CTX_EDIT, |
---|
786 | "moves cursor to the bottom right (end) of the buffer", |
---|
787 | "", ""), |
---|
788 | |
---|
789 | OWLCMD_VOID_CTX("edit:move-to-line-end", owl_editwin_move_to_line_end, |
---|
790 | OWL_CTX_EDIT, |
---|
791 | "moves cursor to the end of the line", |
---|
792 | "", ""), |
---|
793 | |
---|
794 | OWLCMD_VOID_CTX("edit:move-to-line-start", owl_editwin_move_to_line_start, |
---|
795 | OWL_CTX_EDIT, |
---|
796 | "moves cursor to the beginning of the line", |
---|
797 | "", ""), |
---|
798 | |
---|
799 | OWLCMD_VOID_CTX("edit:move-left", owl_editwin_key_left, |
---|
800 | OWL_CTX_EDIT, |
---|
801 | "moves the cursor left by a character", |
---|
802 | "", ""), |
---|
803 | |
---|
804 | OWLCMD_VOID_CTX("edit:move-right", owl_editwin_key_right, |
---|
805 | OWL_CTX_EDIT, |
---|
806 | "moves the cursor right by a character", |
---|
807 | "", ""), |
---|
808 | |
---|
809 | OWLCMD_VOID_CTX("edit:delete-next-word", owl_editwin_delete_nextword, |
---|
810 | OWL_CTX_EDIT, |
---|
811 | "deletes the word to the right of the cursor", |
---|
812 | "", ""), |
---|
813 | |
---|
814 | OWLCMD_VOID_CTX("edit:delete-prev-word", owl_editwin_delete_previousword, |
---|
815 | OWL_CTX_EDIT, |
---|
816 | "deletes the word to the left of the cursor", |
---|
817 | "", ""), |
---|
818 | |
---|
819 | OWLCMD_VOID_CTX("edit:delete-prev-char", owl_editwin_backspace, |
---|
820 | OWL_CTX_EDIT, |
---|
821 | "deletes the character to the left of the cursor", |
---|
822 | "", ""), |
---|
823 | |
---|
824 | OWLCMD_VOID_CTX("edit:delete-next-char", owl_editwin_delete_char, |
---|
825 | OWL_CTX_EDIT, |
---|
826 | "deletes the character to the right of the cursor", |
---|
827 | "", ""), |
---|
828 | |
---|
829 | OWLCMD_VOID_CTX("edit:delete-to-line-end", owl_editwin_delete_to_endofline, |
---|
830 | OWL_CTX_EDIT, |
---|
831 | "deletes from the cursor to the end of the line", |
---|
832 | "", ""), |
---|
833 | |
---|
834 | OWLCMD_VOID_CTX("edit:delete-all", owl_editwin_clear, |
---|
835 | OWL_CTX_EDIT, |
---|
836 | "deletes all of the contents of the buffer", |
---|
837 | "", ""), |
---|
838 | |
---|
839 | OWLCMD_VOID_CTX("edit:transpose-chars", owl_editwin_transpose_chars, |
---|
840 | OWL_CTX_EDIT, |
---|
841 | "Interchange characters around point, moving forward one character.", |
---|
842 | "", ""), |
---|
843 | |
---|
844 | OWLCMD_VOID_CTX("edit:fill-paragraph", owl_editwin_fill_paragraph, |
---|
845 | OWL_CTX_EDIT, |
---|
846 | "fills the current paragraph to line-wrap well", |
---|
847 | "", ""), |
---|
848 | |
---|
849 | OWLCMD_VOID_CTX("edit:recenter", owl_editwin_recenter, |
---|
850 | OWL_CTX_EDIT, |
---|
851 | "recenters the buffer", |
---|
852 | "", ""), |
---|
853 | |
---|
854 | OWLCMD_ARGS_CTX("edit:insert-text", owl_command_edit_insert_text, |
---|
855 | OWL_CTX_EDIT, |
---|
856 | "inserts text into the buffer", |
---|
857 | "edit:insert-text <text>", ""), |
---|
858 | |
---|
859 | OWLCMD_VOID_CTX("edit:cancel", owl_command_edit_cancel, |
---|
860 | OWL_CTX_EDIT, |
---|
861 | "cancels the current command", |
---|
862 | "", ""), |
---|
863 | |
---|
864 | OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next, |
---|
865 | OWL_CTX_EDIT, |
---|
866 | "replaces the text with the next history", |
---|
867 | "", ""), |
---|
868 | |
---|
869 | OWLCMD_VOID_CTX("edit:history-prev", owl_command_edit_history_prev, |
---|
870 | OWL_CTX_EDIT, |
---|
871 | "replaces the text with the previous history", |
---|
872 | "", ""), |
---|
873 | |
---|
874 | OWLCMD_VOID_CTX("edit:set-mark", owl_editwin_set_mark, |
---|
875 | OWL_CTX_EDIT, |
---|
876 | "sets the mark", |
---|
877 | "", ""), |
---|
878 | |
---|
879 | OWLCMD_VOID_CTX("edit:exchange-point-and-mark", owl_editwin_exchange_point_and_mark, |
---|
880 | OWL_CTX_EDIT, |
---|
881 | "exchanges the point and the mark", |
---|
882 | "", ""), |
---|
883 | |
---|
884 | OWLCMD_VOID_CTX("edit:copy-region-as-kill", owl_editwin_copy_region_as_kill, |
---|
885 | OWL_CTX_EDIT, |
---|
886 | "copy the text between the point and the mark", |
---|
887 | "", ""), |
---|
888 | |
---|
889 | OWLCMD_VOID_CTX("edit:kill-region", owl_editwin_kill_region, |
---|
890 | OWL_CTX_EDIT, |
---|
891 | "kill text between the point and the mark", |
---|
892 | "", ""), |
---|
893 | |
---|
894 | OWLCMD_VOID_CTX("edit:yank", owl_editwin_yank, |
---|
895 | OWL_CTX_EDIT, |
---|
896 | "insert the current text from the kill buffer", |
---|
897 | "", ""), |
---|
898 | |
---|
899 | OWLCMD_VOID_CTX("editline:done", owl_command_editline_done, |
---|
900 | OWL_CTX_EDITLINE, |
---|
901 | "completes the command (eg, executes command being composed)", |
---|
902 | "", ""), |
---|
903 | |
---|
904 | OWLCMD_VOID_CTX("editresponse:done", owl_command_editresponse_done, |
---|
905 | OWL_CTX_EDITRESPONSE, |
---|
906 | "completes the response to a question", |
---|
907 | "", ""), |
---|
908 | |
---|
909 | OWLCMD_VOID_CTX("edit:move-up-line", owl_editwin_key_up, |
---|
910 | OWL_CTX_EDITMULTI, |
---|
911 | "moves the cursor up one line", |
---|
912 | "", ""), |
---|
913 | |
---|
914 | OWLCMD_VOID_CTX("edit:move-down-line", owl_editwin_key_down, |
---|
915 | OWL_CTX_EDITMULTI, |
---|
916 | "moves the cursor down one line", |
---|
917 | "", ""), |
---|
918 | |
---|
919 | OWLCMD_VOID_CTX("edit:done", owl_command_edit_done, |
---|
920 | OWL_CTX_EDITMULTI, |
---|
921 | "completes the command (eg, sends message being composed)", |
---|
922 | "", ""), |
---|
923 | |
---|
924 | OWLCMD_VOID_CTX("edit:done-or-delete", owl_command_edit_done_or_delete, |
---|
925 | OWL_CTX_EDITMULTI, |
---|
926 | "completes the command, but only if at end of message", |
---|
927 | "", |
---|
928 | "If only whitespace is to the right of the cursor,\n" |
---|
929 | "runs 'edit:done'.\n"\ |
---|
930 | "Otherwise runs 'edit:delete-next-char'\n"), |
---|
931 | |
---|
932 | OWLCMD_VOID_CTX("edit:forward-paragraph", owl_editwin_forward_paragraph, |
---|
933 | OWL_CTX_EDITMULTI, |
---|
934 | "Move forward to end of paragraph.", |
---|
935 | "", |
---|
936 | "Move the point to the end of the current paragraph"), |
---|
937 | |
---|
938 | OWLCMD_VOID_CTX("edit:backward-paragraph", owl_editwin_backward_paragraph, |
---|
939 | OWL_CTX_EDITMULTI, |
---|
940 | "Move backward to the start of paragraph.", |
---|
941 | "", |
---|
942 | "Move the point to the start of the current paragraph"), |
---|
943 | |
---|
944 | /****************************************************************/ |
---|
945 | /********************** POPLESS-SPECIFIC ************************/ |
---|
946 | /****************************************************************/ |
---|
947 | |
---|
948 | OWLCMD_VOID_CTX("popless:scroll-down-page", owl_viewwin_pagedown, |
---|
949 | OWL_CTX_POPLESS, |
---|
950 | "scrolls down one page", |
---|
951 | "", ""), |
---|
952 | |
---|
953 | OWLCMD_VOID_CTX("popless:scroll-down-line", owl_viewwin_linedown, |
---|
954 | OWL_CTX_POPLESS, |
---|
955 | "scrolls down one line", |
---|
956 | "", ""), |
---|
957 | |
---|
958 | OWLCMD_VOID_CTX("popless:scroll-up-page", owl_viewwin_pageup, |
---|
959 | OWL_CTX_POPLESS, |
---|
960 | "scrolls up one page", |
---|
961 | "", ""), |
---|
962 | |
---|
963 | OWLCMD_VOID_CTX("popless:scroll-up-line", owl_viewwin_lineup, |
---|
964 | OWL_CTX_POPLESS, |
---|
965 | "scrolls up one line", |
---|
966 | "", ""), |
---|
967 | |
---|
968 | OWLCMD_VOID_CTX("popless:scroll-to-top", owl_viewwin_top, |
---|
969 | OWL_CTX_POPLESS, |
---|
970 | "scrolls to the top of the buffer", |
---|
971 | "", ""), |
---|
972 | |
---|
973 | OWLCMD_VOID_CTX("popless:scroll-to-bottom", owl_viewwin_bottom, |
---|
974 | OWL_CTX_POPLESS, |
---|
975 | "scrolls to the bottom of the buffer", |
---|
976 | "", ""), |
---|
977 | |
---|
978 | OWLCMD_INT_CTX ("popless:scroll-right", owl_viewwin_right, |
---|
979 | OWL_CTX_POPLESS, |
---|
980 | "scrolls right in the buffer", |
---|
981 | "popless:scroll-right <num-chars>", ""), |
---|
982 | |
---|
983 | OWLCMD_INT_CTX ("popless:scroll-left", owl_viewwin_left, |
---|
984 | OWL_CTX_POPLESS, |
---|
985 | "scrolls left in the buffer", |
---|
986 | "popless:scroll-left <num-chars>", ""), |
---|
987 | |
---|
988 | OWLCMD_VOID_CTX("popless:quit", owl_command_popless_quit, |
---|
989 | OWL_CTX_POPLESS, |
---|
990 | "exits the popless window", |
---|
991 | "", ""), |
---|
992 | |
---|
993 | OWLCMD_ALIAS("webzephyr", "zwrite daemon.webzephyr -c webzephyr -i"), |
---|
994 | |
---|
995 | /* This line MUST be last! */ |
---|
996 | { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } |
---|
997 | |
---|
998 | }; |
---|
999 | |
---|
1000 | void owl_command_info(void) |
---|
1001 | { |
---|
1002 | owl_function_info(); |
---|
1003 | } |
---|
1004 | |
---|
1005 | void owl_command_nop(void) |
---|
1006 | { |
---|
1007 | } |
---|
1008 | |
---|
1009 | char *owl_command_help(int argc, const char *const *argv, const char *buff) |
---|
1010 | { |
---|
1011 | if (argc!=2) { |
---|
1012 | owl_help(); |
---|
1013 | return NULL; |
---|
1014 | } |
---|
1015 | |
---|
1016 | owl_function_help_for_command(argv[1]); |
---|
1017 | return NULL; |
---|
1018 | } |
---|
1019 | |
---|
1020 | char *owl_command_zlist(int argc, const char *const *argv, const char *buff) |
---|
1021 | { |
---|
1022 | const char *file=NULL; |
---|
1023 | |
---|
1024 | argc--; |
---|
1025 | argv++; |
---|
1026 | while (argc) { |
---|
1027 | if (!strcmp(argv[0], "-f")) { |
---|
1028 | if (argc==1) { |
---|
1029 | owl_function_makemsg("zlist: -f needs an argument"); |
---|
1030 | return(NULL); |
---|
1031 | } |
---|
1032 | file=argv[1]; |
---|
1033 | argc-=2; |
---|
1034 | argv+=2; |
---|
1035 | } else { |
---|
1036 | owl_function_makemsg("zlist: unknown argument"); |
---|
1037 | return(NULL); |
---|
1038 | } |
---|
1039 | } |
---|
1040 | owl_function_buddylist(0, 1, file); |
---|
1041 | return(NULL); |
---|
1042 | } |
---|
1043 | |
---|
1044 | void owl_command_alist(void) |
---|
1045 | { |
---|
1046 | owl_function_buddylist(1, 0, NULL); |
---|
1047 | } |
---|
1048 | |
---|
1049 | void owl_command_blist(void) |
---|
1050 | { |
---|
1051 | owl_function_buddylist(1, 1, NULL); |
---|
1052 | } |
---|
1053 | |
---|
1054 | void owl_command_toggleoneline(void) |
---|
1055 | { |
---|
1056 | owl_function_toggleoneline(); |
---|
1057 | } |
---|
1058 | |
---|
1059 | void owl_command_about(void) |
---|
1060 | { |
---|
1061 | owl_function_about(); |
---|
1062 | } |
---|
1063 | |
---|
1064 | void owl_command_version(void) |
---|
1065 | { |
---|
1066 | owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING); |
---|
1067 | } |
---|
1068 | |
---|
1069 | char *owl_command_aim(int argc, const char *const *argv, const char *buff) |
---|
1070 | { |
---|
1071 | if (argc<2) { |
---|
1072 | owl_function_makemsg("not enough arguments to aim command"); |
---|
1073 | return(NULL); |
---|
1074 | } |
---|
1075 | |
---|
1076 | if (!strcmp(argv[1], "search")) { |
---|
1077 | if (argc!=3) { |
---|
1078 | owl_function_makemsg("not enough arguments to aim search command"); |
---|
1079 | return(NULL); |
---|
1080 | } |
---|
1081 | owl_aim_search(argv[2]); |
---|
1082 | } else { |
---|
1083 | owl_function_makemsg("unknown subcommand '%s' for aim command", argv[1]); |
---|
1084 | return(NULL); |
---|
1085 | } |
---|
1086 | return(NULL); |
---|
1087 | } |
---|
1088 | |
---|
1089 | char *owl_command_addbuddy(int argc, const char *const *argv, const char *buff) |
---|
1090 | { |
---|
1091 | if (argc!=3) { |
---|
1092 | owl_function_makemsg("usage: addbuddy <protocol> <buddyname>"); |
---|
1093 | return(NULL); |
---|
1094 | } |
---|
1095 | |
---|
1096 | if (!strcasecmp(argv[1], "aim")) { |
---|
1097 | if (!owl_global_is_aimloggedin(&g)) { |
---|
1098 | owl_function_makemsg("addbuddy: You must be logged into aim to use this command."); |
---|
1099 | return(NULL); |
---|
1100 | } |
---|
1101 | /* |
---|
1102 | owl_function_makemsg("This function is not yet operational. Stay tuned."); |
---|
1103 | return(NULL); |
---|
1104 | */ |
---|
1105 | owl_aim_addbuddy(argv[2]); |
---|
1106 | owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); |
---|
1107 | } else if (!strcasecmp(argv[1], "zephyr")) { |
---|
1108 | owl_zephyr_addbuddy(argv[2]); |
---|
1109 | owl_function_makemsg("%s added as zephyr buddy", argv[2]); |
---|
1110 | } else { |
---|
1111 | owl_function_makemsg("addbuddy: currently the only supported protocols are 'zephyr' and 'aim'"); |
---|
1112 | } |
---|
1113 | |
---|
1114 | return(NULL); |
---|
1115 | } |
---|
1116 | |
---|
1117 | char *owl_command_delbuddy(int argc, const char *const *argv, const char *buff) |
---|
1118 | { |
---|
1119 | if (argc!=3) { |
---|
1120 | owl_function_makemsg("usage: delbuddy <protocol> <buddyname>"); |
---|
1121 | return(NULL); |
---|
1122 | } |
---|
1123 | |
---|
1124 | if (!strcasecmp(argv[1], "aim")) { |
---|
1125 | if (!owl_global_is_aimloggedin(&g)) { |
---|
1126 | owl_function_makemsg("delbuddy: You must be logged into aim to use this command."); |
---|
1127 | return(NULL); |
---|
1128 | } |
---|
1129 | owl_aim_delbuddy(argv[2]); |
---|
1130 | owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); |
---|
1131 | } else if (!strcasecmp(argv[1], "zephyr")) { |
---|
1132 | owl_zephyr_delbuddy(argv[2]); |
---|
1133 | owl_function_makemsg("%s deleted as zephyr buddy", argv[2]); |
---|
1134 | } else { |
---|
1135 | owl_function_makemsg("delbuddy: currently the only supported protocols are 'zephyr' and 'aim'"); |
---|
1136 | } |
---|
1137 | |
---|
1138 | return(NULL); |
---|
1139 | } |
---|
1140 | |
---|
1141 | char *owl_command_join(int argc, const char *const *argv, const char *buff) |
---|
1142 | { |
---|
1143 | if (argc!=3 && argc!=4) { |
---|
1144 | owl_function_makemsg("usage: join <protocol> <buddyname> [exchange]"); |
---|
1145 | return(NULL); |
---|
1146 | } |
---|
1147 | |
---|
1148 | if (!strcasecmp(argv[1], "aim")) { |
---|
1149 | if (!owl_global_is_aimloggedin(&g)) { |
---|
1150 | owl_function_makemsg("join aim: You must be logged into aim to use this command."); |
---|
1151 | return(NULL); |
---|
1152 | } |
---|
1153 | if (argc==3) { |
---|
1154 | owl_aim_chat_join(argv[2], 4); |
---|
1155 | } else { |
---|
1156 | owl_aim_chat_join(argv[2], atoi(argv[3])); |
---|
1157 | } |
---|
1158 | /* owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); */ |
---|
1159 | } else { |
---|
1160 | owl_function_makemsg("join: currently the only supported protocol is 'aim'"); |
---|
1161 | } |
---|
1162 | return(NULL); |
---|
1163 | } |
---|
1164 | |
---|
1165 | char *owl_command_startup(int argc, const char *const *argv, const char *buff) |
---|
1166 | { |
---|
1167 | const char *ptr; |
---|
1168 | |
---|
1169 | if (argc<2) { |
---|
1170 | owl_function_makemsg("usage: %s <commands> ...", argv[0]); |
---|
1171 | return(NULL); |
---|
1172 | } |
---|
1173 | |
---|
1174 | ptr = skiptokens(buff, 1); |
---|
1175 | |
---|
1176 | owl_function_command(ptr); |
---|
1177 | owl_function_addstartup(ptr); |
---|
1178 | |
---|
1179 | return(NULL); |
---|
1180 | } |
---|
1181 | |
---|
1182 | char *owl_command_unstartup(int argc, const char *const *argv, const char *buff) |
---|
1183 | { |
---|
1184 | const char *ptr; |
---|
1185 | |
---|
1186 | if (argc<2) { |
---|
1187 | owl_function_makemsg("usage: %s <commands> ...", argv[0]); |
---|
1188 | return(NULL); |
---|
1189 | } |
---|
1190 | |
---|
1191 | ptr = skiptokens(buff, 1); |
---|
1192 | |
---|
1193 | owl_function_delstartup(ptr); |
---|
1194 | |
---|
1195 | return(NULL); |
---|
1196 | } |
---|
1197 | |
---|
1198 | char *owl_command_dump(int argc, const char *const *argv, const char *buff) |
---|
1199 | { |
---|
1200 | char *filename; |
---|
1201 | |
---|
1202 | if (argc!=2) { |
---|
1203 | owl_function_makemsg("usage: dump <filename>"); |
---|
1204 | return(NULL); |
---|
1205 | } |
---|
1206 | filename=owl_util_makepath(argv[1]); |
---|
1207 | owl_function_dump(filename); |
---|
1208 | owl_free(filename); |
---|
1209 | return(NULL); |
---|
1210 | } |
---|
1211 | |
---|
1212 | char *owl_command_source(int argc, const char *const *argv, const char *buff) |
---|
1213 | { |
---|
1214 | if (argc!=2) { |
---|
1215 | owl_function_makemsg("usage: source <filename>"); |
---|
1216 | return(NULL); |
---|
1217 | } |
---|
1218 | |
---|
1219 | owl_function_source(argv[1]); |
---|
1220 | return(NULL); |
---|
1221 | } |
---|
1222 | |
---|
1223 | char *owl_command_next(int argc, const char *const *argv, const char *buff) |
---|
1224 | { |
---|
1225 | char *filter=NULL; |
---|
1226 | int skip_deleted=0, last_if_none=0; |
---|
1227 | while (argc>1) { |
---|
1228 | if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) { |
---|
1229 | skip_deleted=1; |
---|
1230 | argc-=1; argv+=1; |
---|
1231 | } else if (argc>=1 && !strcmp(argv[1], "--last-if-none")) { |
---|
1232 | last_if_none=1; |
---|
1233 | argc-=1; argv+=1; |
---|
1234 | } else if (argc>=2 && !strcmp(argv[1], "--filter")) { |
---|
1235 | filter = owl_strdup(argv[2]); |
---|
1236 | argc-=2; argv+=2; |
---|
1237 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { |
---|
1238 | filter = owl_function_smartfilter(0); |
---|
1239 | argc-=2; argv+=2; |
---|
1240 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { |
---|
1241 | filter = owl_function_smartfilter(1); |
---|
1242 | argc-=2; argv+=2; |
---|
1243 | } else { |
---|
1244 | owl_function_makemsg("Invalid arguments to command 'next'."); |
---|
1245 | return(NULL); |
---|
1246 | } |
---|
1247 | } |
---|
1248 | owl_function_nextmsg_full(filter, skip_deleted, last_if_none); |
---|
1249 | if (filter) owl_free(filter); |
---|
1250 | return(NULL); |
---|
1251 | } |
---|
1252 | |
---|
1253 | char *owl_command_prev(int argc, const char *const *argv, const char *buff) |
---|
1254 | { |
---|
1255 | char *filter=NULL; |
---|
1256 | int skip_deleted=0, first_if_none=0; |
---|
1257 | while (argc>1) { |
---|
1258 | if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) { |
---|
1259 | skip_deleted=1; |
---|
1260 | argc-=1; argv+=1; |
---|
1261 | } else if (argc>=1 && !strcmp(argv[1], "--first-if-none")) { |
---|
1262 | first_if_none=1; |
---|
1263 | argc-=1; argv+=1; |
---|
1264 | } else if (argc>=2 && !strcmp(argv[1], "--filter")) { |
---|
1265 | filter = owl_strdup(argv[2]); |
---|
1266 | argc-=2; argv+=2; |
---|
1267 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { |
---|
1268 | filter = owl_function_smartfilter(0); |
---|
1269 | argc-=2; argv+=2; |
---|
1270 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { |
---|
1271 | filter = owl_function_smartfilter(1); |
---|
1272 | argc-=2; argv+=2; |
---|
1273 | } else { |
---|
1274 | owl_function_makemsg("Invalid arguments to command 'prev'."); |
---|
1275 | return(NULL); |
---|
1276 | } |
---|
1277 | } |
---|
1278 | owl_function_prevmsg_full(filter, skip_deleted, first_if_none); |
---|
1279 | if (filter) owl_free(filter); |
---|
1280 | return(NULL); |
---|
1281 | } |
---|
1282 | |
---|
1283 | char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buff) |
---|
1284 | { |
---|
1285 | char *filtname = NULL; |
---|
1286 | |
---|
1287 | if (argc == 1) { |
---|
1288 | filtname = owl_function_smartfilter(0); |
---|
1289 | } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { |
---|
1290 | filtname = owl_function_smartfilter(1); |
---|
1291 | } else { |
---|
1292 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
1293 | } |
---|
1294 | if (filtname) { |
---|
1295 | owl_function_change_currentview_filter(filtname); |
---|
1296 | owl_free(filtname); |
---|
1297 | } |
---|
1298 | return NULL; |
---|
1299 | } |
---|
1300 | |
---|
1301 | char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) |
---|
1302 | { |
---|
1303 | char *filtname = NULL; |
---|
1304 | |
---|
1305 | if (argc == 1) { |
---|
1306 | filtname = owl_function_smartfilter(0); |
---|
1307 | } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { |
---|
1308 | filtname = owl_function_smartfilter(1); |
---|
1309 | } else { |
---|
1310 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
1311 | } |
---|
1312 | return filtname; |
---|
1313 | } |
---|
1314 | |
---|
1315 | void owl_command_expunge(void) |
---|
1316 | { |
---|
1317 | owl_function_expunge(); |
---|
1318 | } |
---|
1319 | |
---|
1320 | void owl_command_first(void) |
---|
1321 | { |
---|
1322 | owl_global_set_rightshift(&g, 0); |
---|
1323 | owl_function_firstmsg(); |
---|
1324 | } |
---|
1325 | |
---|
1326 | void owl_command_last(void) |
---|
1327 | { |
---|
1328 | owl_function_lastmsg(); |
---|
1329 | } |
---|
1330 | |
---|
1331 | void owl_command_resize(void) |
---|
1332 | { |
---|
1333 | owl_function_resize(); |
---|
1334 | } |
---|
1335 | |
---|
1336 | void owl_command_redisplay(void) |
---|
1337 | { |
---|
1338 | owl_function_full_redisplay(); |
---|
1339 | owl_global_set_needrefresh(&g); |
---|
1340 | } |
---|
1341 | |
---|
1342 | char *owl_command_get_shift(int argc, const char *const *argv, const char *buff) |
---|
1343 | { |
---|
1344 | if(argc != 1) |
---|
1345 | { |
---|
1346 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
1347 | return NULL; |
---|
1348 | } |
---|
1349 | return owl_sprintf("%d", owl_global_get_rightshift(&g)); |
---|
1350 | } |
---|
1351 | |
---|
1352 | void owl_command_set_shift(int shift) |
---|
1353 | { |
---|
1354 | owl_global_set_rightshift(&g, shift); |
---|
1355 | owl_mainwin_redisplay(owl_global_get_mainwin(&g)); |
---|
1356 | owl_global_set_needrefresh(&g); |
---|
1357 | } |
---|
1358 | |
---|
1359 | void owl_command_unsuball(void) |
---|
1360 | { |
---|
1361 | owl_function_unsuball(); |
---|
1362 | } |
---|
1363 | |
---|
1364 | char *owl_command_loadsubs(int argc, const char *const *argv, const char *buff) |
---|
1365 | { |
---|
1366 | if (argc == 2) { |
---|
1367 | owl_function_loadsubs(argv[1]); |
---|
1368 | } else if (argc == 1) { |
---|
1369 | owl_function_loadsubs(NULL); |
---|
1370 | } else { |
---|
1371 | owl_function_makemsg("Wrong number of arguments for load-subs."); |
---|
1372 | return(NULL); |
---|
1373 | } |
---|
1374 | return(NULL); |
---|
1375 | } |
---|
1376 | |
---|
1377 | |
---|
1378 | char *owl_command_loadloginsubs(int argc, const char *const *argv, const char *buff) |
---|
1379 | { |
---|
1380 | if (argc == 2) { |
---|
1381 | owl_function_loadloginsubs(argv[1]); |
---|
1382 | } else if (argc == 1) { |
---|
1383 | owl_function_loadloginsubs(NULL); |
---|
1384 | } else { |
---|
1385 | owl_function_makemsg("Wrong number of arguments for load-subs."); |
---|
1386 | return(NULL); |
---|
1387 | } |
---|
1388 | return(NULL); |
---|
1389 | } |
---|
1390 | |
---|
1391 | void owl_command_suspend(void) |
---|
1392 | { |
---|
1393 | owl_function_suspend(); |
---|
1394 | } |
---|
1395 | |
---|
1396 | char *owl_command_start_command(int argc, const char *const *argv, const char *buff) |
---|
1397 | { |
---|
1398 | buff = skiptokens(buff, 1); |
---|
1399 | owl_function_start_command(buff); |
---|
1400 | return(NULL); |
---|
1401 | } |
---|
1402 | |
---|
1403 | char *owl_command_zaway(int argc, const char *const *argv, const char *buff) |
---|
1404 | { |
---|
1405 | if ((argc==1) || |
---|
1406 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
1407 | owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); |
---|
1408 | owl_function_zaway_on(); |
---|
1409 | return NULL; |
---|
1410 | } |
---|
1411 | |
---|
1412 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
1413 | owl_function_zaway_off(); |
---|
1414 | return NULL; |
---|
1415 | } |
---|
1416 | |
---|
1417 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
1418 | owl_function_zaway_toggle(); |
---|
1419 | return NULL; |
---|
1420 | } |
---|
1421 | |
---|
1422 | buff = skiptokens(buff, 1); |
---|
1423 | owl_global_set_zaway_msg(&g, buff); |
---|
1424 | owl_function_zaway_on(); |
---|
1425 | return NULL; |
---|
1426 | } |
---|
1427 | |
---|
1428 | |
---|
1429 | char *owl_command_aaway(int argc, const char *const *argv, const char *buff) |
---|
1430 | { |
---|
1431 | if ((argc==1) || |
---|
1432 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
1433 | owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g)); |
---|
1434 | owl_function_aaway_on(); |
---|
1435 | return NULL; |
---|
1436 | } |
---|
1437 | |
---|
1438 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
1439 | owl_function_aaway_off(); |
---|
1440 | return NULL; |
---|
1441 | } |
---|
1442 | |
---|
1443 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
1444 | owl_function_aaway_toggle(); |
---|
1445 | return NULL; |
---|
1446 | } |
---|
1447 | |
---|
1448 | buff = skiptokens(buff, 1); |
---|
1449 | owl_global_set_aaway_msg(&g, buff); |
---|
1450 | owl_function_aaway_on(); |
---|
1451 | return NULL; |
---|
1452 | } |
---|
1453 | |
---|
1454 | |
---|
1455 | char *owl_command_away(int argc, const char *const *argv, const char *buff) |
---|
1456 | { |
---|
1457 | if ((argc==1) || |
---|
1458 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
1459 | owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g)); |
---|
1460 | owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); |
---|
1461 | owl_function_aaway_on(); |
---|
1462 | owl_function_zaway_on(); |
---|
1463 | owl_function_makemsg("Away messages set."); |
---|
1464 | return NULL; |
---|
1465 | } |
---|
1466 | |
---|
1467 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
1468 | owl_function_aaway_off(); |
---|
1469 | owl_function_zaway_off(); |
---|
1470 | return NULL; |
---|
1471 | } |
---|
1472 | |
---|
1473 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
1474 | /* if either one is on, turn it off, otherwise toggle both (turn |
---|
1475 | * them both on) |
---|
1476 | */ |
---|
1477 | if (!owl_global_is_zaway(&g) && !owl_global_is_aaway(&g)) { |
---|
1478 | owl_function_aaway_toggle(); |
---|
1479 | owl_function_zaway_toggle(); |
---|
1480 | owl_function_makemsg("Away messages set."); |
---|
1481 | } else { |
---|
1482 | if (owl_global_is_zaway(&g)) owl_function_zaway_toggle(); |
---|
1483 | if (owl_global_is_aaway(&g)) owl_function_aaway_toggle(); |
---|
1484 | owl_function_makemsg("Away messages off."); |
---|
1485 | } |
---|
1486 | return NULL; |
---|
1487 | } |
---|
1488 | |
---|
1489 | buff = skiptokens(buff, 1); |
---|
1490 | owl_global_set_aaway_msg(&g, buff); |
---|
1491 | owl_global_set_zaway_msg(&g, buff); |
---|
1492 | owl_function_aaway_on(); |
---|
1493 | owl_function_zaway_on(); |
---|
1494 | owl_function_makemsg("Away messages set."); |
---|
1495 | return NULL; |
---|
1496 | } |
---|
1497 | |
---|
1498 | char *owl_command_set(int argc, const char *const *argv, const char *buff) |
---|
1499 | { |
---|
1500 | const char *var, *val; |
---|
1501 | int silent=0; |
---|
1502 | int requirebool=0; |
---|
1503 | |
---|
1504 | if (argc == 1) { |
---|
1505 | owl_function_printallvars(); |
---|
1506 | return NULL; |
---|
1507 | } |
---|
1508 | |
---|
1509 | if (argc > 1 && !strcmp("-q",argv[1])) { |
---|
1510 | silent = 1; |
---|
1511 | argc--; argv++; |
---|
1512 | } |
---|
1513 | |
---|
1514 | if (argc == 2) { |
---|
1515 | var=argv[1]; |
---|
1516 | val="on"; |
---|
1517 | requirebool=1; |
---|
1518 | } else if (argc == 3) { |
---|
1519 | var=argv[1]; |
---|
1520 | val=argv[2]; |
---|
1521 | } else { |
---|
1522 | owl_function_makemsg("Wrong number of arguments for set command"); |
---|
1523 | return NULL; |
---|
1524 | } |
---|
1525 | owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool); |
---|
1526 | return NULL; |
---|
1527 | } |
---|
1528 | |
---|
1529 | char *owl_command_unset(int argc, const char *const *argv, const char *buff) |
---|
1530 | { |
---|
1531 | const char *var, *val; |
---|
1532 | int silent=0; |
---|
1533 | |
---|
1534 | if (argc > 1 && !strcmp("-q",argv[1])) { |
---|
1535 | silent = 1; |
---|
1536 | argc--; argv++; |
---|
1537 | } |
---|
1538 | if (argc == 2) { |
---|
1539 | var=argv[1]; |
---|
1540 | val="off"; |
---|
1541 | } else { |
---|
1542 | owl_function_makemsg("Wrong number of arguments for unset command"); |
---|
1543 | return NULL; |
---|
1544 | } |
---|
1545 | owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1); |
---|
1546 | return NULL; |
---|
1547 | } |
---|
1548 | |
---|
1549 | char *owl_command_print(int argc, const char *const *argv, const char *buff) |
---|
1550 | { |
---|
1551 | const char *var; |
---|
1552 | char valbuff[1024]; |
---|
1553 | |
---|
1554 | if (argc==1) { |
---|
1555 | owl_function_printallvars(); |
---|
1556 | return NULL; |
---|
1557 | } else if (argc!=2) { |
---|
1558 | owl_function_makemsg("Wrong number of arguments for print command"); |
---|
1559 | return NULL; |
---|
1560 | } |
---|
1561 | |
---|
1562 | var=argv[1]; |
---|
1563 | |
---|
1564 | if (0 == owl_variable_get_tostring(owl_global_get_vardict(&g), |
---|
1565 | var, valbuff, 1024)) { |
---|
1566 | owl_function_makemsg("%s = '%s'", var, valbuff); |
---|
1567 | } else { |
---|
1568 | owl_function_makemsg("Unknown variable '%s'.", var); |
---|
1569 | } |
---|
1570 | return NULL; |
---|
1571 | } |
---|
1572 | |
---|
1573 | |
---|
1574 | char *owl_command_exec(int argc, const char *const *argv, const char *buff) |
---|
1575 | { |
---|
1576 | return owl_function_exec(argc, argv, buff, 0); |
---|
1577 | } |
---|
1578 | |
---|
1579 | char *owl_command_pexec(int argc, const char *const *argv, const char *buff) |
---|
1580 | { |
---|
1581 | return owl_function_exec(argc, argv, buff, 1); |
---|
1582 | } |
---|
1583 | |
---|
1584 | char *owl_command_aexec(int argc, const char *const *argv, const char *buff) |
---|
1585 | { |
---|
1586 | return owl_function_exec(argc, argv, buff, 2); |
---|
1587 | } |
---|
1588 | |
---|
1589 | char *owl_command_perl(int argc, const char *const *argv, const char *buff) |
---|
1590 | { |
---|
1591 | return owl_function_perl(argc, argv, buff, 0); |
---|
1592 | } |
---|
1593 | |
---|
1594 | char *owl_command_pperl(int argc, const char *const *argv, const char *buff) |
---|
1595 | { |
---|
1596 | return owl_function_perl(argc, argv, buff, 1); |
---|
1597 | } |
---|
1598 | |
---|
1599 | char *owl_command_aperl(int argc, const char *const *argv, const char *buff) |
---|
1600 | { |
---|
1601 | return owl_function_perl(argc, argv, buff, 2); |
---|
1602 | } |
---|
1603 | |
---|
1604 | char *owl_command_multi(int argc, const char *const *argv, const char *buff) |
---|
1605 | { |
---|
1606 | char *lastrv = NULL, *newbuff; |
---|
1607 | char **commands; |
---|
1608 | int ncommands, i; |
---|
1609 | if (argc < 2) { |
---|
1610 | owl_function_makemsg("Invalid arguments to 'multi' command."); |
---|
1611 | return NULL; |
---|
1612 | } |
---|
1613 | newbuff = owl_strdup(skiptokens(buff, 1)); |
---|
1614 | if (!strcmp(argv[0], "(")) { |
---|
1615 | for (i=strlen(newbuff)-1; i>=0; i--) { |
---|
1616 | if (newbuff[i] == ')') { |
---|
1617 | newbuff[i] = '\0'; |
---|
1618 | break; |
---|
1619 | } else if (newbuff[i] != ' ') { |
---|
1620 | owl_function_makemsg("Invalid arguments to 'multi' command."); |
---|
1621 | owl_free(newbuff); |
---|
1622 | return NULL; |
---|
1623 | } |
---|
1624 | } |
---|
1625 | } |
---|
1626 | commands = atokenize(newbuff, ";", &ncommands); |
---|
1627 | for (i=0; i<ncommands; i++) { |
---|
1628 | if (lastrv) { |
---|
1629 | owl_free(lastrv); |
---|
1630 | } |
---|
1631 | lastrv = owl_function_command(commands[i]); |
---|
1632 | } |
---|
1633 | owl_free(newbuff); |
---|
1634 | atokenize_delete(commands, ncommands); |
---|
1635 | return lastrv; |
---|
1636 | } |
---|
1637 | |
---|
1638 | |
---|
1639 | char *owl_command_alias(int argc, const char *const *argv, const char *buff) |
---|
1640 | { |
---|
1641 | if (argc < 3) { |
---|
1642 | owl_function_makemsg("Invalid arguments to 'alias' command."); |
---|
1643 | return NULL; |
---|
1644 | } |
---|
1645 | buff = skiptokens(buff, 2); |
---|
1646 | owl_function_command_alias(argv[1], buff); |
---|
1647 | return (NULL); |
---|
1648 | } |
---|
1649 | |
---|
1650 | |
---|
1651 | char *owl_command_bindkey(int argc, const char *const *argv, const char *buff) |
---|
1652 | { |
---|
1653 | owl_keymap *km; |
---|
1654 | int ret; |
---|
1655 | |
---|
1656 | if (argc < 5 || strcmp(argv[3], "command")) { |
---|
1657 | owl_function_makemsg("Usage: bindkey <keymap> <binding> command <cmd>"); |
---|
1658 | return NULL; |
---|
1659 | } |
---|
1660 | km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), argv[1]); |
---|
1661 | if (!km) { |
---|
1662 | owl_function_makemsg("No such keymap '%s'", argv[1]); |
---|
1663 | return NULL; |
---|
1664 | } |
---|
1665 | buff = skiptokens(buff, 4); |
---|
1666 | ret = owl_keymap_create_binding(km, argv[2], buff, NULL, "*user*"); |
---|
1667 | if (ret!=0) { |
---|
1668 | owl_function_makemsg("Unable to bind '%s' in keymap '%s' to '%s'.", |
---|
1669 | argv[2], argv[1], buff); |
---|
1670 | return NULL; |
---|
1671 | } |
---|
1672 | return NULL; |
---|
1673 | } |
---|
1674 | |
---|
1675 | void owl_command_quit(void) |
---|
1676 | { |
---|
1677 | owl_function_quit(); |
---|
1678 | } |
---|
1679 | |
---|
1680 | char *owl_command_debug(int argc, const char *const *argv, const char *buff) |
---|
1681 | { |
---|
1682 | if (argc<2) { |
---|
1683 | owl_function_makemsg("Need at least one argument to debug command"); |
---|
1684 | return(NULL); |
---|
1685 | } |
---|
1686 | |
---|
1687 | if (!owl_global_is_debug_fast(&g)) { |
---|
1688 | owl_function_makemsg("Debugging is not turned on"); |
---|
1689 | return(NULL); |
---|
1690 | } |
---|
1691 | |
---|
1692 | owl_function_debugmsg("%s", argv[1]); |
---|
1693 | return(NULL); |
---|
1694 | } |
---|
1695 | |
---|
1696 | char *owl_command_term(int argc, const char *const *argv, const char *buff) |
---|
1697 | { |
---|
1698 | if (argc<2) { |
---|
1699 | owl_function_makemsg("Need at least one argument to the term command"); |
---|
1700 | return(NULL); |
---|
1701 | } |
---|
1702 | |
---|
1703 | if (!strcmp(argv[1], "raise")) { |
---|
1704 | owl_function_xterm_raise(); |
---|
1705 | } else if (!strcmp(argv[1], "deiconify")) { |
---|
1706 | owl_function_xterm_deiconify(); |
---|
1707 | } else { |
---|
1708 | owl_function_makemsg("Unknown terminal subcommand"); |
---|
1709 | } |
---|
1710 | return(NULL); |
---|
1711 | } |
---|
1712 | |
---|
1713 | char *owl_command_zlog(int argc, const char *const *argv, const char *buff) |
---|
1714 | { |
---|
1715 | if ((argc<2) || (argc>3)) { |
---|
1716 | owl_function_makemsg("Wrong number of arguments for zlog command"); |
---|
1717 | return(NULL); |
---|
1718 | } |
---|
1719 | |
---|
1720 | if (!strcmp(argv[1], "in")) { |
---|
1721 | if (argc>2) { |
---|
1722 | owl_global_set_tty(&g, argv[2]); |
---|
1723 | } |
---|
1724 | owl_zephyr_zlog_in(); |
---|
1725 | } else if (!strcmp(argv[1], "out")) { |
---|
1726 | if (argc!=2) { |
---|
1727 | owl_function_makemsg("Wrong number of arguments for zlog command"); |
---|
1728 | return(NULL); |
---|
1729 | } |
---|
1730 | owl_zephyr_zlog_out(); |
---|
1731 | } else { |
---|
1732 | owl_function_makemsg("Invalid subcommand for zlog"); |
---|
1733 | } |
---|
1734 | return(NULL); |
---|
1735 | } |
---|
1736 | |
---|
1737 | char *owl_command_subscribe(int argc, const char *const *argv, const char *buff) |
---|
1738 | { |
---|
1739 | const char *class, *instance, *recip=""; |
---|
1740 | int temp=0; |
---|
1741 | int ret=0; |
---|
1742 | |
---|
1743 | if (argc < 2) { |
---|
1744 | owl_function_makemsg("Not enough arguments to the subscribe command"); |
---|
1745 | return(NULL); |
---|
1746 | } |
---|
1747 | argc--; |
---|
1748 | argv++; |
---|
1749 | |
---|
1750 | if (!strcmp(argv[0], "-t")) { |
---|
1751 | temp=1; |
---|
1752 | argc--; |
---|
1753 | argv++; |
---|
1754 | } |
---|
1755 | if (argc < 1) { |
---|
1756 | owl_function_makemsg("Not enough arguments to the subscribe command"); |
---|
1757 | return(NULL); |
---|
1758 | } |
---|
1759 | |
---|
1760 | if (argc > 3) { |
---|
1761 | owl_function_makemsg("Too many arguments to the subscribe command"); |
---|
1762 | return(NULL); |
---|
1763 | } |
---|
1764 | |
---|
1765 | class = argv[0]; |
---|
1766 | |
---|
1767 | if (argc == 1) { |
---|
1768 | instance = "*"; |
---|
1769 | } else { |
---|
1770 | instance = argv[1]; |
---|
1771 | } |
---|
1772 | |
---|
1773 | if (argc <= 2) { |
---|
1774 | recip=""; |
---|
1775 | } else if (argc==3) { |
---|
1776 | recip=argv[2]; |
---|
1777 | } |
---|
1778 | |
---|
1779 | ret = owl_function_subscribe(class, instance, recip); |
---|
1780 | if (!temp && !ret) { |
---|
1781 | owl_zephyr_addsub(NULL, class, instance, recip); |
---|
1782 | } |
---|
1783 | return(NULL); |
---|
1784 | } |
---|
1785 | |
---|
1786 | |
---|
1787 | char *owl_command_unsubscribe(int argc, const char *const *argv, const char *buff) |
---|
1788 | { |
---|
1789 | const char *class, *instance, *recip=""; |
---|
1790 | int temp=0; |
---|
1791 | |
---|
1792 | if (argc < 2) { |
---|
1793 | owl_function_makemsg("Not enough arguments to the unsubscribe command"); |
---|
1794 | return(NULL); |
---|
1795 | } |
---|
1796 | argc--; |
---|
1797 | argv++; |
---|
1798 | |
---|
1799 | if (!strcmp(argv[0], "-t")) { |
---|
1800 | temp=1; |
---|
1801 | argc--; |
---|
1802 | argv++; |
---|
1803 | } |
---|
1804 | if (argc < 1) { |
---|
1805 | owl_function_makemsg("Not enough arguments to the unsubscribe command"); |
---|
1806 | return(NULL); |
---|
1807 | } |
---|
1808 | |
---|
1809 | if (argc > 3) { |
---|
1810 | owl_function_makemsg("Too many arguments to the unsubscribe command"); |
---|
1811 | return(NULL); |
---|
1812 | } |
---|
1813 | |
---|
1814 | class = argv[0]; |
---|
1815 | |
---|
1816 | if (argc == 1) { |
---|
1817 | instance = "*"; |
---|
1818 | } else { |
---|
1819 | instance = argv[1]; |
---|
1820 | } |
---|
1821 | |
---|
1822 | if (argc <= 2) { |
---|
1823 | recip=""; |
---|
1824 | } else if (argc==3) { |
---|
1825 | recip=argv[2]; |
---|
1826 | } |
---|
1827 | |
---|
1828 | owl_function_unsubscribe(class, instance, recip); |
---|
1829 | if (!temp) { |
---|
1830 | owl_zephyr_delsub(NULL, class, instance, recip); |
---|
1831 | } |
---|
1832 | return(NULL); |
---|
1833 | } |
---|
1834 | |
---|
1835 | char *owl_command_echo(int argc, const char *const *argv, const char *buff) |
---|
1836 | { |
---|
1837 | buff = skiptokens(buff, 1); |
---|
1838 | owl_function_popless_text(buff); |
---|
1839 | return NULL; |
---|
1840 | } |
---|
1841 | |
---|
1842 | void owl_command_getsubs(void) |
---|
1843 | { |
---|
1844 | owl_function_getsubs(); |
---|
1845 | } |
---|
1846 | |
---|
1847 | void owl_command_status(void) |
---|
1848 | { |
---|
1849 | owl_function_status(); |
---|
1850 | } |
---|
1851 | |
---|
1852 | char *owl_command_zwrite(int argc, const char *const *argv, const char *buff) |
---|
1853 | { |
---|
1854 | owl_zwrite z; |
---|
1855 | |
---|
1856 | if (!owl_global_is_havezephyr(&g)) { |
---|
1857 | owl_function_makemsg("Zephyr is not available"); |
---|
1858 | return(NULL); |
---|
1859 | } |
---|
1860 | /* check for a zwrite -m */ |
---|
1861 | owl_zwrite_create_from_line(&z, buff); |
---|
1862 | if (owl_zwrite_is_message_set(&z)) { |
---|
1863 | owl_function_zwrite(buff, NULL); |
---|
1864 | owl_zwrite_cleanup(&z); |
---|
1865 | return (NULL); |
---|
1866 | } |
---|
1867 | owl_zwrite_cleanup(&z); |
---|
1868 | |
---|
1869 | if (argc < 2) { |
---|
1870 | owl_function_makemsg("Not enough arguments to the zwrite command."); |
---|
1871 | } else { |
---|
1872 | owl_function_zwrite_setup(buff); |
---|
1873 | } |
---|
1874 | return(NULL); |
---|
1875 | } |
---|
1876 | |
---|
1877 | char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff) |
---|
1878 | { |
---|
1879 | char *newbuff, *recip; |
---|
1880 | const char *const *myargv; |
---|
1881 | int i, j, myargc; |
---|
1882 | owl_message *m; |
---|
1883 | |
---|
1884 | if (!owl_global_is_aimloggedin(&g)) { |
---|
1885 | owl_function_makemsg("You are not logged in to AIM."); |
---|
1886 | return(NULL); |
---|
1887 | } |
---|
1888 | |
---|
1889 | if (argc < 2) { |
---|
1890 | owl_function_makemsg("Not enough arguments to the aimwrite command."); |
---|
1891 | return(NULL); |
---|
1892 | } |
---|
1893 | |
---|
1894 | myargv=argv; |
---|
1895 | if (argc<0) { |
---|
1896 | owl_function_error("Unbalanced quotes in aimwrite"); |
---|
1897 | return(NULL); |
---|
1898 | } |
---|
1899 | myargc=argc; |
---|
1900 | if (myargc && *(myargv[0])!='-') { |
---|
1901 | myargc--; |
---|
1902 | myargv++; |
---|
1903 | } |
---|
1904 | while (myargc) { |
---|
1905 | if (!strcmp(myargv[0], "-m")) { |
---|
1906 | if (myargc<2) { |
---|
1907 | break; |
---|
1908 | } |
---|
1909 | |
---|
1910 | /* Once we have -m, gobble up everything else on the line */ |
---|
1911 | myargv++; |
---|
1912 | myargc--; |
---|
1913 | newbuff=owl_strdup(""); |
---|
1914 | while (myargc) { |
---|
1915 | newbuff=owl_realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5); |
---|
1916 | strcat(newbuff, myargv[0]); |
---|
1917 | strcat(newbuff, " "); |
---|
1918 | myargc--; |
---|
1919 | myargv++; |
---|
1920 | } |
---|
1921 | if (strlen(newbuff) >= 1) |
---|
1922 | newbuff[strlen(newbuff) - 1] = '\0'; /* remove last space */ |
---|
1923 | |
---|
1924 | recip=owl_strdup(argv[1]); |
---|
1925 | owl_aim_send_im(recip, newbuff); |
---|
1926 | m=owl_function_make_outgoing_aim(newbuff, recip); |
---|
1927 | if (m) { |
---|
1928 | owl_global_messagequeue_addmsg(&g, m); |
---|
1929 | } else { |
---|
1930 | owl_function_error("Could not create outgoing AIM message"); |
---|
1931 | } |
---|
1932 | |
---|
1933 | owl_free(recip); |
---|
1934 | owl_free(newbuff); |
---|
1935 | return(NULL); |
---|
1936 | } else { |
---|
1937 | /* we don't care */ |
---|
1938 | myargv++; |
---|
1939 | myargc--; |
---|
1940 | } |
---|
1941 | } |
---|
1942 | |
---|
1943 | /* squish arguments together to make one screenname w/o spaces for now */ |
---|
1944 | newbuff=owl_malloc(strlen(buff)+5); |
---|
1945 | sprintf(newbuff, "%s ", argv[0]); |
---|
1946 | j=argc-1; |
---|
1947 | for (i=0; i<j; i++) { |
---|
1948 | strcat(newbuff, argv[i+1]); |
---|
1949 | } |
---|
1950 | |
---|
1951 | owl_function_aimwrite_setup(newbuff); |
---|
1952 | owl_free(newbuff); |
---|
1953 | return(NULL); |
---|
1954 | } |
---|
1955 | |
---|
1956 | char *owl_command_loopwrite(int argc, const char *const *argv, const char *buff) |
---|
1957 | { |
---|
1958 | owl_function_loopwrite_setup(); |
---|
1959 | return(NULL); |
---|
1960 | } |
---|
1961 | |
---|
1962 | char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff) |
---|
1963 | { |
---|
1964 | #ifdef OWL_ENABLE_ZCRYPT |
---|
1965 | owl_zwrite z; |
---|
1966 | |
---|
1967 | if (!owl_global_is_havezephyr(&g)) { |
---|
1968 | owl_function_makemsg("Zephyr is not available"); |
---|
1969 | return(NULL); |
---|
1970 | } |
---|
1971 | /* check for a zcrypt -m */ |
---|
1972 | owl_zwrite_create_from_line(&z, buff); |
---|
1973 | if (owl_zwrite_is_message_set(&z)) { |
---|
1974 | owl_function_zcrypt(buff, NULL); |
---|
1975 | owl_zwrite_cleanup(&z); |
---|
1976 | return (NULL); |
---|
1977 | } |
---|
1978 | owl_zwrite_cleanup(&z); |
---|
1979 | |
---|
1980 | if (argc < 2) { |
---|
1981 | owl_function_makemsg("Not enough arguments to the zcrypt command."); |
---|
1982 | } else { |
---|
1983 | owl_function_zwrite_setup(buff); |
---|
1984 | } |
---|
1985 | return(NULL); |
---|
1986 | #else |
---|
1987 | owl_function_makemsg("This Owl does not support zcrypt"); |
---|
1988 | return NULL; |
---|
1989 | #endif |
---|
1990 | } |
---|
1991 | |
---|
1992 | char *owl_command_reply(int argc, const char *const *argv, const char *buff) |
---|
1993 | { |
---|
1994 | int edit=0; |
---|
1995 | |
---|
1996 | if (argc>=2 && !strcmp("-e", argv[1])) { |
---|
1997 | edit=1; |
---|
1998 | argv++; |
---|
1999 | argc--; |
---|
2000 | } |
---|
2001 | |
---|
2002 | if ((argc==1) || (argc==2 && !strcmp(argv[1], "all"))) { |
---|
2003 | owl_function_reply(0, !edit); |
---|
2004 | } else if (argc==2 && !strcmp(argv[1], "sender")) { |
---|
2005 | owl_function_reply(1, !edit); |
---|
2006 | } else if (argc==2 && !strcmp(argv[1], "zaway")) { |
---|
2007 | const owl_message *m; |
---|
2008 | const owl_view *v; |
---|
2009 | v = owl_global_get_current_view(&g); |
---|
2010 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
2011 | if (m) owl_zephyr_zaway(m); |
---|
2012 | } else { |
---|
2013 | owl_function_makemsg("Invalid arguments to the reply command."); |
---|
2014 | } |
---|
2015 | return NULL; |
---|
2016 | } |
---|
2017 | |
---|
2018 | char *owl_command_filter(int argc, const char *const *argv, const char *buff) |
---|
2019 | { |
---|
2020 | owl_function_create_filter(argc, argv); |
---|
2021 | return NULL; |
---|
2022 | } |
---|
2023 | |
---|
2024 | char *owl_command_zlocate(int argc, const char *const *argv, const char *buff) |
---|
2025 | { |
---|
2026 | int auth; |
---|
2027 | |
---|
2028 | if (argc<2) { |
---|
2029 | owl_function_makemsg("Too few arguments for zlocate command"); |
---|
2030 | return NULL; |
---|
2031 | } |
---|
2032 | |
---|
2033 | auth=1; |
---|
2034 | if (!strcmp(argv[1], "-d")) { |
---|
2035 | if (argc>2) { |
---|
2036 | auth=0; |
---|
2037 | argc--; |
---|
2038 | argv++; |
---|
2039 | } else { |
---|
2040 | owl_function_makemsg("Missing arguments for zlocate command"); |
---|
2041 | return NULL; |
---|
2042 | } |
---|
2043 | } |
---|
2044 | |
---|
2045 | argc--; |
---|
2046 | argv++; |
---|
2047 | owl_function_zlocate(argc, argv, auth); |
---|
2048 | return NULL; |
---|
2049 | } |
---|
2050 | |
---|
2051 | |
---|
2052 | /* Backwards compatability has made this kind of complicated: |
---|
2053 | * view [<viewname>] [-f <filter> | -d <expression> | --home | -r ] [-s <style>] |
---|
2054 | * view <filter> |
---|
2055 | * view -d <expression> |
---|
2056 | * view --home |
---|
2057 | */ |
---|
2058 | char *owl_command_view(int argc, const char *const *argv, const char *buff) |
---|
2059 | { |
---|
2060 | /* First take the 'view --home' and 'view -r' cases */ |
---|
2061 | if (argc == 2) { |
---|
2062 | if (!strcmp(argv[1], "--home")) { |
---|
2063 | owl_function_change_currentview_filter(owl_global_get_view_home(&g)); |
---|
2064 | return(NULL); |
---|
2065 | } else if (!strcmp(argv[1], "-r")) { |
---|
2066 | char *foo; |
---|
2067 | foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); |
---|
2068 | owl_function_change_currentview_filter(foo); |
---|
2069 | owl_free(foo); |
---|
2070 | return(NULL); |
---|
2071 | } |
---|
2072 | } |
---|
2073 | |
---|
2074 | /* Now look for 'view <filter>' */ |
---|
2075 | if (argc==2) { |
---|
2076 | owl_function_change_currentview_filter(argv[1]); |
---|
2077 | return(NULL); |
---|
2078 | } |
---|
2079 | |
---|
2080 | /* Now get 'view -d <expression>' */ |
---|
2081 | if (argc>=3 && !strcmp(argv[1], "-d")) { |
---|
2082 | const char **myargv; |
---|
2083 | int i; |
---|
2084 | |
---|
2085 | myargv=owl_malloc((argc*sizeof(const char *))+50); |
---|
2086 | myargv[0]=""; |
---|
2087 | myargv[1]="owl-dynamic"; |
---|
2088 | for (i=2; i<argc; i++) { |
---|
2089 | myargv[i]=argv[i]; |
---|
2090 | } |
---|
2091 | owl_function_create_filter(argc, myargv); |
---|
2092 | owl_function_change_currentview_filter("owl-dynamic"); |
---|
2093 | owl_free(myargv); |
---|
2094 | return NULL; |
---|
2095 | } |
---|
2096 | |
---|
2097 | /* Finally handle the general case */ |
---|
2098 | if (argc<3) { |
---|
2099 | owl_function_makemsg("Too few arguments to the view command."); |
---|
2100 | return(NULL); |
---|
2101 | } |
---|
2102 | argc--; |
---|
2103 | argv++; |
---|
2104 | if (strcmp(argv[0], "-f") && |
---|
2105 | strcmp(argv[0], "-d") && |
---|
2106 | strcmp(argv[0], "--home") && |
---|
2107 | strcmp(argv[0], "-s") && |
---|
2108 | strcmp(argv[0], "-r")) { |
---|
2109 | if (strcmp(argv[0], "main")) { |
---|
2110 | owl_function_makemsg("No view named '%s'", argv[0]); |
---|
2111 | return(NULL); |
---|
2112 | } |
---|
2113 | argc--; |
---|
2114 | argv++; |
---|
2115 | } |
---|
2116 | while (argc) { |
---|
2117 | if (!strcmp(argv[0], "-f")) { |
---|
2118 | if (argc<2) { |
---|
2119 | owl_function_makemsg("Too few argments to the view command"); |
---|
2120 | return(NULL); |
---|
2121 | } |
---|
2122 | owl_function_change_currentview_filter(argv[1]); |
---|
2123 | argc-=2; |
---|
2124 | argv+=2; |
---|
2125 | } else if (!strcmp(argv[0], "--home")) { |
---|
2126 | owl_function_change_currentview_filter(owl_global_get_view_home(&g)); |
---|
2127 | argc--; |
---|
2128 | argv++; |
---|
2129 | } else if (!strcmp(argv[0], "-r")) { |
---|
2130 | const char *foo; |
---|
2131 | foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); |
---|
2132 | owl_function_change_currentview_filter(foo); |
---|
2133 | } else if (!strcmp(argv[0], "-s")) { |
---|
2134 | if (argc<2) { |
---|
2135 | owl_function_makemsg("Too few argments to the view command"); |
---|
2136 | return(NULL); |
---|
2137 | } |
---|
2138 | owl_function_change_style(owl_global_get_current_view(&g), argv[1]); |
---|
2139 | argc-=2; |
---|
2140 | argv+=2; |
---|
2141 | } else { |
---|
2142 | owl_function_makemsg("Too few argments to the view command"); |
---|
2143 | return(NULL); |
---|
2144 | } |
---|
2145 | |
---|
2146 | } |
---|
2147 | return(NULL); |
---|
2148 | } |
---|
2149 | |
---|
2150 | char *owl_command_show(int argc, const char *const *argv, const char *buff) |
---|
2151 | { |
---|
2152 | if (argc<2) { |
---|
2153 | owl_function_help_for_command("show"); |
---|
2154 | return NULL; |
---|
2155 | } |
---|
2156 | |
---|
2157 | if (!strcmp(argv[1], "filter") || !strcmp(argv[1], "filters")) { |
---|
2158 | if (argc==2) { |
---|
2159 | owl_function_show_filters(); |
---|
2160 | } else { |
---|
2161 | owl_function_show_filter(argv[2]); |
---|
2162 | } |
---|
2163 | } else if (argc==2 |
---|
2164 | && (!strcmp(argv[1], "zpunts") || !strcmp(argv[1], "zpunted"))) { |
---|
2165 | owl_function_show_zpunts(); |
---|
2166 | } else if (!strcmp(argv[1], "command") || !strcmp(argv[1], "commands")) { |
---|
2167 | if (argc==2) { |
---|
2168 | owl_function_show_commands(); |
---|
2169 | } else { |
---|
2170 | owl_function_show_command(argv[2]); |
---|
2171 | } |
---|
2172 | } else if (!strcmp(argv[1], "variable") || !strcmp(argv[1], "variables")) { |
---|
2173 | if (argc==2) { |
---|
2174 | owl_function_show_variables(); |
---|
2175 | } else { |
---|
2176 | owl_function_show_variable(argv[2]); |
---|
2177 | } |
---|
2178 | } else if (!strcmp(argv[1], "keymap") || !strcmp(argv[1], "keymaps")) { |
---|
2179 | if (argc==2) { |
---|
2180 | owl_function_show_keymaps(); |
---|
2181 | } else { |
---|
2182 | owl_function_show_keymap(argv[2]); |
---|
2183 | } |
---|
2184 | } else if (!strcmp(argv[1], "view")) { |
---|
2185 | if (argc==3) { |
---|
2186 | owl_function_show_view(argv[2]); |
---|
2187 | } else { |
---|
2188 | owl_function_show_view(NULL); |
---|
2189 | } |
---|
2190 | } else if (!strcmp(argv[1], "colors")) { |
---|
2191 | owl_function_show_colors(); |
---|
2192 | } else if (!strcmp(argv[1], "styles")) { |
---|
2193 | owl_function_show_styles(); |
---|
2194 | } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) { |
---|
2195 | owl_function_getsubs(); |
---|
2196 | } else if (!strcmp(argv[1], "terminal") || !strcmp(argv[1], "term")) { |
---|
2197 | owl_function_show_term(); |
---|
2198 | } else if (!strcmp(argv[1], "version")) { |
---|
2199 | owl_function_about(); |
---|
2200 | } else if (!strcmp(argv[1], "status")) { |
---|
2201 | owl_function_status(); |
---|
2202 | } else if (!strcmp(argv[1], "license")) { |
---|
2203 | owl_function_show_license(); |
---|
2204 | } else if (!strcmp(argv[1], "quickstart")) { |
---|
2205 | owl_function_show_quickstart(); |
---|
2206 | } else if (!strcmp(argv[1], "startup")) { |
---|
2207 | const char *filename; |
---|
2208 | |
---|
2209 | filename=owl_global_get_startupfile(&g); |
---|
2210 | owl_function_popless_file(filename); |
---|
2211 | } else if (!strcmp(argv[1], "errors")) { |
---|
2212 | owl_function_showerrs(); |
---|
2213 | } else { |
---|
2214 | owl_function_makemsg("Unknown subcommand for 'show' command (see 'help show' for allowed args)"); |
---|
2215 | return NULL; |
---|
2216 | } |
---|
2217 | return NULL; |
---|
2218 | } |
---|
2219 | |
---|
2220 | char *owl_command_viewclass(int argc, const char *const *argv, const char *buff) |
---|
2221 | { |
---|
2222 | char *filtname; |
---|
2223 | if (argc!=2) { |
---|
2224 | owl_function_makemsg("Wrong number of arguments to viewclass command"); |
---|
2225 | return NULL; |
---|
2226 | } |
---|
2227 | filtname = owl_function_classinstfilt(argv[1], NULL); |
---|
2228 | owl_function_change_currentview_filter(filtname); |
---|
2229 | owl_free(filtname); |
---|
2230 | return NULL; |
---|
2231 | } |
---|
2232 | |
---|
2233 | char *owl_command_viewuser(int argc, const char *const *argv, const char *buff) |
---|
2234 | { |
---|
2235 | char *filtname; |
---|
2236 | if (argc!=2) { |
---|
2237 | owl_function_makemsg("Wrong number of arguments to viewuser command"); |
---|
2238 | return NULL; |
---|
2239 | } |
---|
2240 | filtname=owl_function_zuserfilt(argv[1]); |
---|
2241 | owl_function_change_currentview_filter(filtname); |
---|
2242 | owl_free(filtname); |
---|
2243 | return NULL; |
---|
2244 | } |
---|
2245 | |
---|
2246 | |
---|
2247 | void owl_command_pop_message(void) |
---|
2248 | { |
---|
2249 | owl_function_curmsg_to_popwin(); |
---|
2250 | } |
---|
2251 | |
---|
2252 | char *owl_command_delete(int argc, const char *const *argv, const char *buff) |
---|
2253 | { |
---|
2254 | int move_after = 1; |
---|
2255 | |
---|
2256 | if (argc>1 && !strcmp(argv[1], "--no-move")) { |
---|
2257 | move_after = 0; |
---|
2258 | argc--; |
---|
2259 | argv++; |
---|
2260 | } |
---|
2261 | |
---|
2262 | if (argc==1) { |
---|
2263 | owl_function_deletecur(move_after); |
---|
2264 | return NULL; |
---|
2265 | } |
---|
2266 | |
---|
2267 | if (argc==2 && !strcmp(argv[1], "view")) { |
---|
2268 | owl_function_delete_curview_msgs(1); |
---|
2269 | return NULL; |
---|
2270 | } |
---|
2271 | |
---|
2272 | if (argc==2 && !strcmp(argv[1], "trash")) { |
---|
2273 | owl_function_delete_automsgs(); |
---|
2274 | return NULL; |
---|
2275 | } |
---|
2276 | |
---|
2277 | if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { |
---|
2278 | owl_function_delete_by_id(atoi(argv[2]), 1); |
---|
2279 | return NULL; |
---|
2280 | } |
---|
2281 | |
---|
2282 | owl_function_makemsg("Unknown arguments to delete command"); |
---|
2283 | return NULL; |
---|
2284 | } |
---|
2285 | |
---|
2286 | char *owl_command_undelete(int argc, const char *const *argv, const char *buff) |
---|
2287 | { |
---|
2288 | int move_after = 1; |
---|
2289 | |
---|
2290 | if (argc>1 && !strcmp(argv[1], "--no-move")) { |
---|
2291 | move_after = 0; |
---|
2292 | argc--; |
---|
2293 | argv++; |
---|
2294 | } |
---|
2295 | |
---|
2296 | if (argc==1) { |
---|
2297 | owl_function_undeletecur(move_after); |
---|
2298 | return NULL; |
---|
2299 | } |
---|
2300 | |
---|
2301 | if (argc==2 && !strcmp(argv[1], "view")) { |
---|
2302 | owl_function_delete_curview_msgs(0); |
---|
2303 | return NULL; |
---|
2304 | } |
---|
2305 | |
---|
2306 | if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { |
---|
2307 | owl_function_delete_by_id(atoi(argv[2]), 0); |
---|
2308 | return NULL; |
---|
2309 | } |
---|
2310 | |
---|
2311 | owl_function_makemsg("Unknown arguments to delete command"); |
---|
2312 | return NULL; |
---|
2313 | } |
---|
2314 | |
---|
2315 | void owl_command_beep(void) |
---|
2316 | { |
---|
2317 | owl_function_beep(); |
---|
2318 | } |
---|
2319 | |
---|
2320 | char *owl_command_colorview(int argc, const char *const *argv, const char *buff) |
---|
2321 | { |
---|
2322 | if (argc < 2 || argc > 3) { |
---|
2323 | owl_function_makemsg("Wrong number of arguments to colorview command"); |
---|
2324 | return NULL; |
---|
2325 | } |
---|
2326 | owl_function_color_current_filter(argv[1], (argc == 3 ? argv[2] : NULL)); |
---|
2327 | return NULL; |
---|
2328 | } |
---|
2329 | |
---|
2330 | char *owl_command_colorclass(int argc, const char *const *argv, const char *buff) |
---|
2331 | { |
---|
2332 | const char *filtname; |
---|
2333 | |
---|
2334 | if (argc < 3 || argc > 4) { |
---|
2335 | owl_function_makemsg("Wrong number of arguments to colorclass command"); |
---|
2336 | return NULL; |
---|
2337 | } |
---|
2338 | |
---|
2339 | filtname=owl_function_classinstfilt(argv[1], NULL); |
---|
2340 | (void) owl_function_color_filter(filtname, argv[2], (argc == 4 ? argv[3] : NULL)); |
---|
2341 | return NULL; |
---|
2342 | } |
---|
2343 | |
---|
2344 | char *owl_command_zpunt(int argc, const char *const *argv, const char *buff) |
---|
2345 | { |
---|
2346 | owl_command_zpunt_and_zunpunt(argc, argv, 0); |
---|
2347 | return NULL; |
---|
2348 | } |
---|
2349 | |
---|
2350 | char *owl_command_zunpunt(int argc, const char *const *argv, const char *buff) |
---|
2351 | { |
---|
2352 | owl_command_zpunt_and_zunpunt(argc, argv, 1); |
---|
2353 | return NULL; |
---|
2354 | } |
---|
2355 | |
---|
2356 | void owl_command_zpunt_and_zunpunt(int argc, const char *const *argv, int type) |
---|
2357 | { |
---|
2358 | /* if type==0 then zpunt |
---|
2359 | * if type==1 then zunpunt |
---|
2360 | */ |
---|
2361 | const char *class, *inst, *recip; |
---|
2362 | |
---|
2363 | class="message"; |
---|
2364 | inst=""; |
---|
2365 | recip="*"; |
---|
2366 | |
---|
2367 | if (argc==1) { |
---|
2368 | /* show current punt filters */ |
---|
2369 | owl_function_show_zpunts(); |
---|
2370 | return; |
---|
2371 | } else if (argc==2) { |
---|
2372 | inst=argv[1]; |
---|
2373 | } else if (argc==3) { |
---|
2374 | class=argv[1]; |
---|
2375 | inst=argv[2]; |
---|
2376 | } else if (argc==4) { |
---|
2377 | class=argv[1]; |
---|
2378 | inst=argv[2]; |
---|
2379 | recip=argv[3]; |
---|
2380 | } else { |
---|
2381 | owl_function_makemsg("Wrong number of arguments to the zpunt command"); |
---|
2382 | return; |
---|
2383 | } |
---|
2384 | |
---|
2385 | owl_function_zpunt(class, inst, recip, type); |
---|
2386 | if (type==0) { |
---|
2387 | owl_function_makemsg("<%s, %s, %s> added to punt list.", class, inst, recip); |
---|
2388 | } else if (type==1) { |
---|
2389 | owl_function_makemsg("<%s, %s, %s> removed from punt list.", class, inst, recip); |
---|
2390 | } |
---|
2391 | } |
---|
2392 | |
---|
2393 | char *owl_command_smartzpunt(int argc, const char *const *argv, const char *buff) |
---|
2394 | { |
---|
2395 | if (argc == 1) { |
---|
2396 | owl_function_smartzpunt(0); |
---|
2397 | } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { |
---|
2398 | owl_function_smartzpunt(1); |
---|
2399 | } else { |
---|
2400 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
2401 | } |
---|
2402 | return NULL; |
---|
2403 | } |
---|
2404 | |
---|
2405 | char *owl_command_punt(int argc, const char *const *argv, const char *buff) |
---|
2406 | { |
---|
2407 | owl_command_punt_unpunt(argc, argv, buff, 0); |
---|
2408 | return NULL; |
---|
2409 | } |
---|
2410 | |
---|
2411 | char *owl_command_unpunt(int argc, const char *const *argv, const char *buff) |
---|
2412 | { |
---|
2413 | owl_command_punt_unpunt(argc, argv, buff, 1); |
---|
2414 | return NULL; |
---|
2415 | } |
---|
2416 | |
---|
2417 | void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt) |
---|
2418 | { |
---|
2419 | owl_list * fl; |
---|
2420 | owl_filter * f; |
---|
2421 | char * text; |
---|
2422 | int i; |
---|
2423 | |
---|
2424 | fl = owl_global_get_puntlist(&g); |
---|
2425 | if(argc == 1) { |
---|
2426 | owl_function_show_zpunts(); |
---|
2427 | } |
---|
2428 | |
---|
2429 | if(argc == 2) { |
---|
2430 | /* Handle :unpunt <number> */ |
---|
2431 | if(unpunt && (i=atoi(argv[1])) !=0) { |
---|
2432 | i--; /* Accept 1-based indexing */ |
---|
2433 | if(i < owl_list_get_size(fl)) { |
---|
2434 | f = owl_list_get_element(fl, i); |
---|
2435 | owl_list_remove_element(fl, i); |
---|
2436 | owl_filter_delete(f); |
---|
2437 | return; |
---|
2438 | } else { |
---|
2439 | owl_function_error("No such filter number: %d", i+1); |
---|
2440 | } |
---|
2441 | } |
---|
2442 | text = owl_sprintf("filter %s", argv[1]); |
---|
2443 | owl_function_punt(text, unpunt); |
---|
2444 | owl_free(text); |
---|
2445 | } else { |
---|
2446 | owl_function_punt(skiptokens(buff, 1), unpunt); |
---|
2447 | } |
---|
2448 | } |
---|
2449 | |
---|
2450 | |
---|
2451 | char *owl_command_getview(int argc, const char *const *argv, const char *buff) |
---|
2452 | { |
---|
2453 | const char *filtname; |
---|
2454 | if (argc != 1) { |
---|
2455 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
2456 | return NULL; |
---|
2457 | } |
---|
2458 | filtname = owl_view_get_filtname(owl_global_get_current_view(&g)); |
---|
2459 | if (filtname) return owl_strdup(filtname); |
---|
2460 | return NULL; |
---|
2461 | } |
---|
2462 | |
---|
2463 | char *owl_command_getvar(int argc, const char *const *argv, const char *buff) |
---|
2464 | { |
---|
2465 | char tmpbuff[1024]; |
---|
2466 | if (argc != 2) { |
---|
2467 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
2468 | return NULL; |
---|
2469 | } |
---|
2470 | if (owl_variable_get_tostring(owl_global_get_vardict(&g), |
---|
2471 | argv[1], tmpbuff, 1024)) { |
---|
2472 | return NULL; |
---|
2473 | } |
---|
2474 | return owl_strdup(tmpbuff); |
---|
2475 | } |
---|
2476 | |
---|
2477 | char *owl_command_getfilter(int argc, const char *const *argv, const char *buf) |
---|
2478 | { |
---|
2479 | const owl_filter *f; |
---|
2480 | if (argc != 2) { |
---|
2481 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
2482 | return NULL; |
---|
2483 | } |
---|
2484 | f = owl_global_get_filter(&g, argv[1]); |
---|
2485 | if (!f) { |
---|
2486 | return NULL; |
---|
2487 | } |
---|
2488 | return owl_filter_print(f); |
---|
2489 | } |
---|
2490 | |
---|
2491 | char *owl_command_search(int argc, const char *const *argv, const char *buff) |
---|
2492 | { |
---|
2493 | int direction; |
---|
2494 | const char *buffstart; |
---|
2495 | |
---|
2496 | direction=OWL_DIRECTION_DOWNWARDS; |
---|
2497 | buffstart=skiptokens(buff, 1); |
---|
2498 | if (argc>1 && !strcmp(argv[1], "-r")) { |
---|
2499 | direction=OWL_DIRECTION_UPWARDS; |
---|
2500 | buffstart=skiptokens(buff, 2); |
---|
2501 | } |
---|
2502 | |
---|
2503 | if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) { |
---|
2504 | owl_function_search_continue(direction); |
---|
2505 | } else { |
---|
2506 | owl_function_search_start(buffstart, direction); |
---|
2507 | } |
---|
2508 | |
---|
2509 | return(NULL); |
---|
2510 | } |
---|
2511 | |
---|
2512 | char *owl_command_setsearch(int argc, const char *const *argv, const char *buff) |
---|
2513 | { |
---|
2514 | const char *buffstart; |
---|
2515 | |
---|
2516 | buffstart=skiptokens(buff, 1); |
---|
2517 | owl_function_search_start(*buffstart ? buffstart : NULL, OWL_DIRECTION_NONE); |
---|
2518 | |
---|
2519 | return(NULL); |
---|
2520 | } |
---|
2521 | |
---|
2522 | char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff) |
---|
2523 | { |
---|
2524 | if ((argc<2) || (argc>3)) { |
---|
2525 | owl_function_makemsg("Wrong number of arguments to aimlogin command"); |
---|
2526 | return(NULL); |
---|
2527 | } |
---|
2528 | |
---|
2529 | /* if we get two arguments, ask for the password */ |
---|
2530 | if (argc==2) { |
---|
2531 | owl_global_set_buffercommand(&g, argv[1]); |
---|
2532 | owl_global_set_buffercallback(&g, &owl_callback_aimlogin); |
---|
2533 | owl_function_start_password("AIM Password: "); |
---|
2534 | return(NULL); |
---|
2535 | } else { |
---|
2536 | owl_function_aimlogin(argv[1], argv[2]); |
---|
2537 | } |
---|
2538 | |
---|
2539 | /* this is a test */ |
---|
2540 | return(NULL); |
---|
2541 | } |
---|
2542 | |
---|
2543 | char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff) |
---|
2544 | { |
---|
2545 | /* clear the buddylist */ |
---|
2546 | owl_buddylist_clear(owl_global_get_buddylist(&g)); |
---|
2547 | |
---|
2548 | owl_aim_logout(); |
---|
2549 | return(NULL); |
---|
2550 | } |
---|
2551 | |
---|
2552 | char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) |
---|
2553 | { |
---|
2554 | const char *stylename; |
---|
2555 | if (argc != 1) { |
---|
2556 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
2557 | return NULL; |
---|
2558 | } |
---|
2559 | stylename = owl_view_get_style_name(owl_global_get_current_view(&g)); |
---|
2560 | if (stylename) return owl_strdup(stylename); |
---|
2561 | return NULL; |
---|
2562 | } |
---|
2563 | |
---|
2564 | char *owl_command_error(int argc, const char *const *argv, const char *buff) |
---|
2565 | { |
---|
2566 | buff = skiptokens(buff, 1); |
---|
2567 | owl_function_error("%s", buff); |
---|
2568 | return NULL; |
---|
2569 | } |
---|
2570 | |
---|
2571 | char *owl_command_message(int argc, const char *const *argv, const char *buff) |
---|
2572 | { |
---|
2573 | buff = skiptokens(buff, 1); |
---|
2574 | owl_function_makemsg("%s", buff); |
---|
2575 | return NULL; |
---|
2576 | } |
---|
2577 | |
---|
2578 | void owl_command_yes(void) |
---|
2579 | { |
---|
2580 | owl_message *m; |
---|
2581 | const owl_view *v; |
---|
2582 | const char *cmd; |
---|
2583 | |
---|
2584 | v = owl_global_get_current_view(&g); |
---|
2585 | |
---|
2586 | /* bail if there's no current message */ |
---|
2587 | if (owl_view_get_size(v) < 1) { |
---|
2588 | owl_function_error("No current message."); |
---|
2589 | return; |
---|
2590 | } |
---|
2591 | |
---|
2592 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
2593 | if(!owl_message_is_question(m)) { |
---|
2594 | owl_function_error("That message isn't a question."); |
---|
2595 | return; |
---|
2596 | } |
---|
2597 | if(owl_message_is_answered(m)) { |
---|
2598 | owl_function_error("You already answered that question."); |
---|
2599 | return; |
---|
2600 | } |
---|
2601 | cmd = owl_message_get_attribute_value(m, "yescommand"); |
---|
2602 | if(!cmd) { |
---|
2603 | owl_function_error("No 'yes' command!"); |
---|
2604 | return; |
---|
2605 | } |
---|
2606 | |
---|
2607 | owl_function_command_norv(cmd); |
---|
2608 | owl_message_set_isanswered(m); |
---|
2609 | return; |
---|
2610 | } |
---|
2611 | |
---|
2612 | void owl_command_no(void) |
---|
2613 | { |
---|
2614 | owl_message *m; |
---|
2615 | const owl_view *v; |
---|
2616 | const char *cmd; |
---|
2617 | |
---|
2618 | v = owl_global_get_current_view(&g); |
---|
2619 | |
---|
2620 | /* bail if there's no current message */ |
---|
2621 | if (owl_view_get_size(v) < 1) { |
---|
2622 | owl_function_error("No current message."); |
---|
2623 | return; |
---|
2624 | } |
---|
2625 | |
---|
2626 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
2627 | if(!owl_message_is_question(m)) { |
---|
2628 | owl_function_error("That message isn't a question."); |
---|
2629 | return; |
---|
2630 | } |
---|
2631 | if(owl_message_is_answered(m)) { |
---|
2632 | owl_function_error("You already answered that question."); |
---|
2633 | return; |
---|
2634 | } |
---|
2635 | cmd = owl_message_get_attribute_value(m, "nocommand"); |
---|
2636 | if(!cmd) { |
---|
2637 | owl_function_error("No 'no' command!"); |
---|
2638 | return; |
---|
2639 | } |
---|
2640 | |
---|
2641 | owl_function_command_norv(cmd); |
---|
2642 | owl_message_set_isanswered(m); |
---|
2643 | return; |
---|
2644 | } |
---|
2645 | |
---|
2646 | /*********************************************************************/ |
---|
2647 | /************************** EDIT SPECIFIC ****************************/ |
---|
2648 | /*********************************************************************/ |
---|
2649 | |
---|
2650 | void owl_command_edit_cancel(owl_editwin *e) |
---|
2651 | { |
---|
2652 | owl_history *hist; |
---|
2653 | |
---|
2654 | owl_function_makemsg("Command cancelled."); |
---|
2655 | |
---|
2656 | if(owl_editwin_get_echochar(e) == 0) { |
---|
2657 | hist=owl_editwin_get_history(e); |
---|
2658 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
2659 | owl_history_reset(hist); |
---|
2660 | } |
---|
2661 | |
---|
2662 | owl_editwin_fullclear(e); |
---|
2663 | owl_global_set_needrefresh(&g); |
---|
2664 | update_panels(); |
---|
2665 | owl_global_set_typwin_inactive(&g); |
---|
2666 | owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL); |
---|
2667 | |
---|
2668 | owl_global_pop_context(&g); |
---|
2669 | } |
---|
2670 | |
---|
2671 | void owl_command_edit_history_prev(owl_editwin *e) |
---|
2672 | { |
---|
2673 | owl_history *hist; |
---|
2674 | const char *ptr; |
---|
2675 | |
---|
2676 | hist=owl_editwin_get_history(e); |
---|
2677 | if (!owl_history_is_touched(hist)) { |
---|
2678 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
2679 | owl_history_set_partial(hist); |
---|
2680 | } |
---|
2681 | ptr=owl_history_get_prev(hist); |
---|
2682 | if (ptr) { |
---|
2683 | owl_editwin_clear(e); |
---|
2684 | owl_editwin_insert_string(e, ptr); |
---|
2685 | owl_editwin_redisplay(e); |
---|
2686 | owl_global_set_needrefresh(&g); |
---|
2687 | } else { |
---|
2688 | owl_function_beep(); |
---|
2689 | } |
---|
2690 | } |
---|
2691 | |
---|
2692 | void owl_command_edit_history_next(owl_editwin *e) |
---|
2693 | { |
---|
2694 | owl_history *hist; |
---|
2695 | const char *ptr; |
---|
2696 | |
---|
2697 | hist=owl_editwin_get_history(e); |
---|
2698 | ptr=owl_history_get_next(hist); |
---|
2699 | if (ptr) { |
---|
2700 | owl_editwin_clear(e); |
---|
2701 | owl_editwin_insert_string(e, ptr); |
---|
2702 | owl_editwin_redisplay(e); |
---|
2703 | owl_global_set_needrefresh(&g); |
---|
2704 | } else { |
---|
2705 | owl_function_beep(); |
---|
2706 | } |
---|
2707 | } |
---|
2708 | |
---|
2709 | char *owl_command_edit_insert_text(owl_editwin *e, int argc, const char *const *argv, const char *buff) |
---|
2710 | { |
---|
2711 | buff = skiptokens(buff, 1); |
---|
2712 | owl_editwin_insert_string(e, buff); |
---|
2713 | owl_editwin_redisplay(e); |
---|
2714 | owl_global_set_needrefresh(&g); |
---|
2715 | return NULL; |
---|
2716 | } |
---|
2717 | |
---|
2718 | void owl_command_editline_done(owl_editwin *e) |
---|
2719 | { |
---|
2720 | owl_history *hist=owl_editwin_get_history(e); |
---|
2721 | char *rv, *cmd; |
---|
2722 | |
---|
2723 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
2724 | owl_history_reset(hist); |
---|
2725 | owl_global_set_typwin_inactive(&g); |
---|
2726 | owl_global_pop_context(&g); |
---|
2727 | cmd = owl_strdup(owl_editwin_get_text(e)); |
---|
2728 | owl_editwin_fullclear(e); |
---|
2729 | rv = owl_function_command(cmd); |
---|
2730 | owl_free(cmd); |
---|
2731 | |
---|
2732 | update_panels(); |
---|
2733 | owl_global_set_needrefresh(&g); |
---|
2734 | |
---|
2735 | if (rv) { |
---|
2736 | owl_function_makemsg("%s", rv); |
---|
2737 | owl_free(rv); |
---|
2738 | } |
---|
2739 | } |
---|
2740 | |
---|
2741 | |
---|
2742 | void owl_command_editresponse_done(owl_editwin *e) |
---|
2743 | { |
---|
2744 | owl_function_run_buffercommand(); |
---|
2745 | |
---|
2746 | owl_global_set_typwin_inactive(&g); |
---|
2747 | owl_global_pop_context(&g); |
---|
2748 | owl_editwin_fullclear(e); |
---|
2749 | update_panels(); |
---|
2750 | owl_global_set_needrefresh(&g); |
---|
2751 | } |
---|
2752 | |
---|
2753 | |
---|
2754 | void owl_command_edit_done(owl_editwin *e) |
---|
2755 | { |
---|
2756 | owl_history *hist=owl_editwin_get_history(e); |
---|
2757 | |
---|
2758 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
2759 | owl_history_reset(hist); |
---|
2760 | |
---|
2761 | owl_function_run_buffercommand(); |
---|
2762 | owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL); |
---|
2763 | owl_editwin_fullclear(e); |
---|
2764 | owl_global_set_typwin_inactive(&g); |
---|
2765 | owl_global_pop_context(&g); |
---|
2766 | owl_global_set_needrefresh(&g); |
---|
2767 | update_panels(); |
---|
2768 | } |
---|
2769 | |
---|
2770 | void owl_command_edit_done_or_delete(owl_editwin *e) |
---|
2771 | { |
---|
2772 | if (owl_editwin_is_at_end(e)) { |
---|
2773 | owl_command_edit_done(e); |
---|
2774 | } else { |
---|
2775 | owl_editwin_delete_char(e); |
---|
2776 | } |
---|
2777 | } |
---|
2778 | |
---|
2779 | |
---|
2780 | /*********************************************************************/ |
---|
2781 | /*********************** POPLESS SPECIFIC ****************************/ |
---|
2782 | /*********************************************************************/ |
---|
2783 | |
---|
2784 | void owl_command_popless_quit(owl_viewwin *vw) |
---|
2785 | { |
---|
2786 | owl_popwin_close(owl_global_get_popwin(&g)); |
---|
2787 | owl_global_pop_context(&g); |
---|
2788 | owl_viewwin_cleanup(vw); |
---|
2789 | owl_global_set_needrefresh(&g); |
---|
2790 | } |
---|