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