source: commands.c @ 0c10a79

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