source: commands.c @ 2674412

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