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