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