source: commands.c @ 9854278

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