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