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