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