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