[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" |
---|
[f17bff98] | 656 | "show variables\n" |
---|
| 657 | "show variable <variable>\n" |
---|
[7d4fbcd] | 658 | "show version\n" |
---|
[ef56a67] | 659 | "show view [<view>]\n" |
---|
[f17bff98] | 660 | "show zpunts\n", |
---|
[7d4fbcd] | 661 | |
---|
| 662 | "Show colors will display a list of valid colors for the\n" |
---|
| 663 | " terminal." |
---|
| 664 | "Show filters will list the names of all filters.\n" |
---|
| 665 | "Show filter <filter> will show the definition of a particular\n" |
---|
| 666 | " filter.\n\n" |
---|
[f17bff98] | 667 | "Show startup will display the custom startup config\n\n" |
---|
[7d4fbcd] | 668 | "Show zpunts will show the active zpunt filters.\n\n" |
---|
| 669 | "Show keymaps will list the names of all keymaps.\n" |
---|
| 670 | "Show keymap <keymap> will show the key bindings in a keymap.\n\n" |
---|
| 671 | "Show commands will list the names of all keymaps.\n" |
---|
| 672 | "Show command <command> will provide information about a command.\n\n" |
---|
[f1e629d] | 673 | "Show styles will list the names of all styles available\n" |
---|
| 674 | "for formatting messages.\n\n" |
---|
[7d4fbcd] | 675 | "Show variables will list the names of all variables.\n\n" |
---|
[d544237] | 676 | "Show errors will show a list of errors encountered by Owl.\n\n" |
---|
[7d4fbcd] | 677 | "SEE ALSO: filter, view, alias, bindkey, help\n"), |
---|
| 678 | |
---|
| 679 | OWLCMD_ARGS("delete", owl_command_delete, OWL_CTX_INTERACTIVE, |
---|
| 680 | "mark a message for deletion", |
---|
[b950088] | 681 | "delete [ -id msgid ] [ --no-move ]\n" |
---|
[7d4fbcd] | 682 | "delete view\n" |
---|
| 683 | "delete trash", |
---|
| 684 | "If no message id is specified the current message is marked\n" |
---|
| 685 | "for deletion. Otherwise the message with the given message\n" |
---|
[451db9e] | 686 | "id is marked for deletion.\n" |
---|
[b950088] | 687 | "If '--no-move' is specified, don't move after deletion.\n" |
---|
[7d4fbcd] | 688 | "If 'trash' is specified, deletes all trash/auto messages\n" |
---|
| 689 | "in the current view.\n" |
---|
| 690 | "If 'view' is specified, deletes all messages in the\n" |
---|
| 691 | "current view.\n"), |
---|
| 692 | OWLCMD_ALIAS("del", "delete"), |
---|
| 693 | |
---|
| 694 | OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE, |
---|
| 695 | "unmark a message for deletion", |
---|
[b950088] | 696 | "undelete [ -id msgid ] [ --no-move ]\n" |
---|
[7d4fbcd] | 697 | "undelete view", |
---|
| 698 | "If no message id is specified the current message is\n" |
---|
| 699 | "unmarked for deletion. Otherwise the message with the\n" |
---|
[451db9e] | 700 | "given message id is unmarked for deletion.\n" |
---|
[b950088] | 701 | "If '--no-move' is specified, don't move after deletion.\n" |
---|
[7d4fbcd] | 702 | "If 'view' is specified, undeletes all messages\n" |
---|
| 703 | "in the current view.\n"), |
---|
| 704 | OWLCMD_ALIAS("undel", "undelete"), |
---|
| 705 | |
---|
| 706 | OWLCMD_VOID("beep", owl_command_beep, OWL_CTX_ANY, |
---|
| 707 | "ring the terminal bell", |
---|
| 708 | "beep", |
---|
| 709 | "Beep will ring the terminal bell.\n" |
---|
| 710 | "If the variable 'bell' has been\n" |
---|
| 711 | "set to 'off' this command does nothing.\n"), |
---|
| 712 | |
---|
| 713 | OWLCMD_ARGS("debug", owl_command_debug, OWL_CTX_ANY, |
---|
| 714 | "prints a message into the debug log", |
---|
| 715 | "debug <message>", ""), |
---|
| 716 | |
---|
[8ee73f8d] | 717 | OWLCMD_ARGS("getview", owl_command_getview, OWL_CTX_INTERACTIVE, |
---|
| 718 | "returns the name of the filter for the current view", |
---|
| 719 | "", ""), |
---|
| 720 | |
---|
| 721 | OWLCMD_ARGS("getvar", owl_command_getvar, OWL_CTX_INTERACTIVE, |
---|
| 722 | "returns the value of a variable", |
---|
| 723 | "getvar <varname>", ""), |
---|
| 724 | |
---|
[cdc6ff1] | 725 | OWLCMD_ARGS("getfilter", owl_command_getfilter, OWL_CTX_INTERACTIVE, |
---|
| 726 | "returns the definition of a filter", |
---|
| 727 | "getfilter <filtername>", ""), |
---|
| 728 | |
---|
[216c734] | 729 | OWLCMD_ARGS("getstyle", owl_command_getstyle, OWL_CTX_INTERACTIVE, |
---|
| 730 | "returns the name of the style for the current view", |
---|
| 731 | "", ""), |
---|
| 732 | |
---|
[1fd0b25] | 733 | OWLCMD_ARGS("search", owl_command_search, OWL_CTX_INTERACTIVE, |
---|
| 734 | "search messages for a particular string", |
---|
| 735 | "search [-r] [<string>]", |
---|
| 736 | "The search command will find messages that contain the\n" |
---|
| 737 | "specified string and move the cursor there. If no string\n" |
---|
| 738 | "argument is supplied then the previous one is used. By\n" |
---|
[451db9e] | 739 | "default searches are done forwards; if -r is used the search\n" |
---|
[1fd0b25] | 740 | "is performed backwards"), |
---|
| 741 | |
---|
[987ff51] | 742 | OWLCMD_ARGS("setsearch", owl_command_setsearch, OWL_CTX_INTERACTIVE, |
---|
| 743 | "set the search highlight string without searching", |
---|
| 744 | "setsearch <string>", |
---|
[d544237] | 745 | "The setsearch command highlights all occurrences of its\n" |
---|
[987ff51] | 746 | "argument and makes it the default argument for future\n" |
---|
| 747 | "search commands, but does not move the cursor. With\n" |
---|
[451db9e] | 748 | "no argument, it makes search highlighting inactive."), |
---|
[987ff51] | 749 | |
---|
[d09e5a1] | 750 | OWLCMD_ARGS("aimlogin", owl_command_aimlogin, OWL_CTX_ANY, |
---|
| 751 | "login to an AIM account", |
---|
[453bd70] | 752 | "aimlogin <screenname> [<password>]\n", |
---|
[d09e5a1] | 753 | ""), |
---|
| 754 | |
---|
| 755 | OWLCMD_ARGS("aimlogout", owl_command_aimlogout, OWL_CTX_ANY, |
---|
| 756 | "logout from AIM", |
---|
| 757 | "aimlogout\n", |
---|
| 758 | ""), |
---|
| 759 | |
---|
[4692b70] | 760 | OWLCMD_ARGS("error", owl_command_error, OWL_CTX_ANY, |
---|
| 761 | "Display an error message", |
---|
| 762 | "error <message>", |
---|
| 763 | ""), |
---|
| 764 | |
---|
| 765 | OWLCMD_ARGS("message", owl_command_message, OWL_CTX_ANY, |
---|
[b1fd36e] | 766 | "Display an informative message", |
---|
[4692b70] | 767 | "message <message>", |
---|
| 768 | ""), |
---|
[d09e5a1] | 769 | |
---|
[f4d32cd] | 770 | OWLCMD_VOID("yes", owl_command_yes, OWL_CTX_RECV, |
---|
| 771 | "Answer yes to a question", |
---|
| 772 | "yes", |
---|
| 773 | ""), |
---|
| 774 | |
---|
| 775 | OWLCMD_VOID("no", owl_command_no, OWL_CTX_RECV, |
---|
| 776 | "Answer no to a question", |
---|
| 777 | "no", |
---|
| 778 | ""), |
---|
| 779 | |
---|
[7d4fbcd] | 780 | /****************************************************************/ |
---|
| 781 | /************************* EDIT-SPECIFIC ************************/ |
---|
| 782 | /****************************************************************/ |
---|
| 783 | |
---|
| 784 | OWLCMD_VOID_CTX("edit:move-next-word", owl_editwin_move_to_nextword, |
---|
| 785 | OWL_CTX_EDIT, |
---|
| 786 | "moves cursor forward a word", |
---|
| 787 | "", ""), |
---|
| 788 | |
---|
| 789 | OWLCMD_VOID_CTX("edit:move-prev-word", owl_editwin_move_to_previousword, |
---|
| 790 | OWL_CTX_EDIT, |
---|
| 791 | "moves cursor backwards a word", |
---|
| 792 | "", ""), |
---|
| 793 | |
---|
| 794 | OWLCMD_VOID_CTX("edit:move-to-buffer-start", owl_editwin_move_to_top, |
---|
| 795 | OWL_CTX_EDIT, |
---|
| 796 | "moves cursor to the top left (start) of the buffer", |
---|
| 797 | "", ""), |
---|
| 798 | |
---|
| 799 | OWLCMD_VOID_CTX("edit:move-to-buffer-end", owl_editwin_move_to_end, |
---|
| 800 | OWL_CTX_EDIT, |
---|
| 801 | "moves cursor to the bottom right (end) of the buffer", |
---|
| 802 | "", ""), |
---|
| 803 | |
---|
| 804 | OWLCMD_VOID_CTX("edit:move-to-line-end", owl_editwin_move_to_line_end, |
---|
| 805 | OWL_CTX_EDIT, |
---|
| 806 | "moves cursor to the end of the line", |
---|
| 807 | "", ""), |
---|
| 808 | |
---|
| 809 | OWLCMD_VOID_CTX("edit:move-to-line-start", owl_editwin_move_to_line_start, |
---|
| 810 | OWL_CTX_EDIT, |
---|
| 811 | "moves cursor to the beginning of the line", |
---|
| 812 | "", ""), |
---|
| 813 | |
---|
| 814 | OWLCMD_VOID_CTX("edit:move-left", owl_editwin_key_left, |
---|
| 815 | OWL_CTX_EDIT, |
---|
| 816 | "moves the cursor left by a character", |
---|
| 817 | "", ""), |
---|
| 818 | |
---|
| 819 | OWLCMD_VOID_CTX("edit:move-right", owl_editwin_key_right, |
---|
| 820 | OWL_CTX_EDIT, |
---|
| 821 | "moves the cursor right by a character", |
---|
| 822 | "", ""), |
---|
| 823 | |
---|
| 824 | OWLCMD_VOID_CTX("edit:delete-next-word", owl_editwin_delete_nextword, |
---|
| 825 | OWL_CTX_EDIT, |
---|
| 826 | "deletes the word to the right of the cursor", |
---|
| 827 | "", ""), |
---|
| 828 | |
---|
[b68f9cd] | 829 | OWLCMD_VOID_CTX("edit:delete-prev-word", owl_editwin_delete_previousword, |
---|
| 830 | OWL_CTX_EDIT, |
---|
| 831 | "deletes the word to the left of the cursor", |
---|
| 832 | "", ""), |
---|
| 833 | |
---|
[7d4fbcd] | 834 | OWLCMD_VOID_CTX("edit:delete-prev-char", owl_editwin_backspace, |
---|
| 835 | OWL_CTX_EDIT, |
---|
| 836 | "deletes the character to the left of the cursor", |
---|
| 837 | "", ""), |
---|
| 838 | |
---|
| 839 | OWLCMD_VOID_CTX("edit:delete-next-char", owl_editwin_delete_char, |
---|
| 840 | OWL_CTX_EDIT, |
---|
| 841 | "deletes the character to the right of the cursor", |
---|
| 842 | "", ""), |
---|
| 843 | |
---|
| 844 | OWLCMD_VOID_CTX("edit:delete-to-line-end", owl_editwin_delete_to_endofline, |
---|
| 845 | OWL_CTX_EDIT, |
---|
| 846 | "deletes from the cursor to the end of the line", |
---|
| 847 | "", ""), |
---|
| 848 | |
---|
| 849 | OWLCMD_VOID_CTX("edit:delete-all", owl_editwin_clear, |
---|
| 850 | OWL_CTX_EDIT, |
---|
| 851 | "deletes all of the contents of the buffer", |
---|
| 852 | "", ""), |
---|
| 853 | |
---|
[f2e36b5] | 854 | OWLCMD_VOID_CTX("edit:transpose-chars", owl_editwin_transpose_chars, |
---|
| 855 | OWL_CTX_EDIT, |
---|
| 856 | "Interchange characters around point, moving forward one character.", |
---|
| 857 | "", ""), |
---|
| 858 | |
---|
[7d4fbcd] | 859 | OWLCMD_VOID_CTX("edit:fill-paragraph", owl_editwin_fill_paragraph, |
---|
| 860 | OWL_CTX_EDIT, |
---|
| 861 | "fills the current paragraph to line-wrap well", |
---|
| 862 | "", ""), |
---|
| 863 | |
---|
| 864 | OWLCMD_VOID_CTX("edit:recenter", owl_editwin_recenter, |
---|
| 865 | OWL_CTX_EDIT, |
---|
| 866 | "recenters the buffer", |
---|
| 867 | "", ""), |
---|
| 868 | |
---|
| 869 | OWLCMD_ARGS_CTX("edit:insert-text", owl_command_edit_insert_text, |
---|
| 870 | OWL_CTX_EDIT, |
---|
| 871 | "inserts text into the buffer", |
---|
| 872 | "edit:insert-text <text>", ""), |
---|
| 873 | |
---|
| 874 | OWLCMD_VOID_CTX("edit:cancel", owl_command_edit_cancel, |
---|
| 875 | OWL_CTX_EDIT, |
---|
| 876 | "cancels the current command", |
---|
| 877 | "", ""), |
---|
| 878 | |
---|
| 879 | OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next, |
---|
[10b866d] | 880 | OWL_CTX_EDIT, |
---|
[5ade618] | 881 | "replaces the text with the next history", |
---|
[7d4fbcd] | 882 | "", ""), |
---|
| 883 | |
---|
| 884 | OWLCMD_VOID_CTX("edit:history-prev", owl_command_edit_history_prev, |
---|
[10b866d] | 885 | OWL_CTX_EDIT, |
---|
[7d4fbcd] | 886 | "replaces the text with the previous history", |
---|
| 887 | "", ""), |
---|
| 888 | |
---|
[7f0c26f] | 889 | OWLCMD_VOID_CTX("edit:set-mark", owl_editwin_set_mark, |
---|
| 890 | OWL_CTX_EDIT, |
---|
| 891 | "sets the mark", |
---|
| 892 | "", ""), |
---|
| 893 | |
---|
| 894 | OWLCMD_VOID_CTX("edit:exchange-point-and-mark", owl_editwin_exchange_point_and_mark, |
---|
| 895 | OWL_CTX_EDIT, |
---|
| 896 | "exchanges the point and the mark", |
---|
| 897 | "", ""), |
---|
| 898 | |
---|
[a60edf2] | 899 | OWLCMD_VOID_CTX("edit:copy-region-as-kill", owl_editwin_copy_region_as_kill, |
---|
| 900 | OWL_CTX_EDIT, |
---|
| 901 | "copy the text between the point and the mark", |
---|
| 902 | "", ""), |
---|
| 903 | |
---|
| 904 | OWLCMD_VOID_CTX("edit:kill-region", owl_editwin_kill_region, |
---|
| 905 | OWL_CTX_EDIT, |
---|
| 906 | "kill text between the point and the mark", |
---|
| 907 | "", ""), |
---|
| 908 | |
---|
| 909 | OWLCMD_VOID_CTX("edit:yank", owl_editwin_yank, |
---|
| 910 | OWL_CTX_EDIT, |
---|
| 911 | "insert the current text from the kill buffer", |
---|
| 912 | "", ""), |
---|
| 913 | |
---|
[5934b87] | 914 | OWLCMD_ALIAS ("editline:done", "edit:done"), |
---|
[0d17295] | 915 | OWLCMD_ALIAS ("editresponse:done", "edit:done"), |
---|
[cf83b7a] | 916 | |
---|
[435d6b2] | 917 | OWLCMD_VOID_CTX("edit:move-up-line", owl_editwin_key_up, |
---|
[7d4fbcd] | 918 | OWL_CTX_EDITMULTI, |
---|
| 919 | "moves the cursor up one line", |
---|
| 920 | "", ""), |
---|
| 921 | |
---|
[435d6b2] | 922 | OWLCMD_VOID_CTX("edit:move-down-line", owl_editwin_key_down, |
---|
[7d4fbcd] | 923 | OWL_CTX_EDITMULTI, |
---|
| 924 | "moves the cursor down one line", |
---|
| 925 | "", ""), |
---|
| 926 | |
---|
[435d6b2] | 927 | OWLCMD_VOID_CTX("edit:done", owl_command_edit_done, |
---|
[0d17295] | 928 | OWL_CTX_EDIT, |
---|
| 929 | "Finishes entering text in the editwin.", |
---|
[7d4fbcd] | 930 | "", ""), |
---|
| 931 | |
---|
[435d6b2] | 932 | OWLCMD_VOID_CTX("edit:done-or-delete", owl_command_edit_done_or_delete, |
---|
[217a43e] | 933 | OWL_CTX_EDITMULTI, |
---|
| 934 | "completes the command, but only if at end of message", |
---|
| 935 | "", |
---|
| 936 | "If only whitespace is to the right of the cursor,\n" |
---|
[435d6b2] | 937 | "runs 'edit:done'.\n"\ |
---|
[217a43e] | 938 | "Otherwise runs 'edit:delete-next-char'\n"), |
---|
| 939 | |
---|
[435d6b2] | 940 | OWLCMD_VOID_CTX("edit:forward-paragraph", owl_editwin_forward_paragraph, |
---|
[2fc8397] | 941 | OWL_CTX_EDITMULTI, |
---|
| 942 | "Move forward to end of paragraph.", |
---|
| 943 | "", |
---|
| 944 | "Move the point to the end of the current paragraph"), |
---|
| 945 | |
---|
[435d6b2] | 946 | OWLCMD_VOID_CTX("edit:backward-paragraph", owl_editwin_backward_paragraph, |
---|
[2fc8397] | 947 | OWL_CTX_EDITMULTI, |
---|
| 948 | "Move backward to the start of paragraph.", |
---|
| 949 | "", |
---|
| 950 | "Move the point to the start of the current paragraph"), |
---|
| 951 | |
---|
[7d4fbcd] | 952 | /****************************************************************/ |
---|
| 953 | /********************** POPLESS-SPECIFIC ************************/ |
---|
| 954 | /****************************************************************/ |
---|
| 955 | |
---|
| 956 | OWLCMD_VOID_CTX("popless:scroll-down-page", owl_viewwin_pagedown, |
---|
| 957 | OWL_CTX_POPLESS, |
---|
| 958 | "scrolls down one page", |
---|
| 959 | "", ""), |
---|
| 960 | |
---|
| 961 | OWLCMD_VOID_CTX("popless:scroll-down-line", owl_viewwin_linedown, |
---|
| 962 | OWL_CTX_POPLESS, |
---|
| 963 | "scrolls down one line", |
---|
| 964 | "", ""), |
---|
| 965 | |
---|
| 966 | OWLCMD_VOID_CTX("popless:scroll-up-page", owl_viewwin_pageup, |
---|
| 967 | OWL_CTX_POPLESS, |
---|
| 968 | "scrolls up one page", |
---|
| 969 | "", ""), |
---|
| 970 | |
---|
| 971 | OWLCMD_VOID_CTX("popless:scroll-up-line", owl_viewwin_lineup, |
---|
| 972 | OWL_CTX_POPLESS, |
---|
| 973 | "scrolls up one line", |
---|
| 974 | "", ""), |
---|
| 975 | |
---|
| 976 | OWLCMD_VOID_CTX("popless:scroll-to-top", owl_viewwin_top, |
---|
| 977 | OWL_CTX_POPLESS, |
---|
| 978 | "scrolls to the top of the buffer", |
---|
| 979 | "", ""), |
---|
| 980 | |
---|
| 981 | OWLCMD_VOID_CTX("popless:scroll-to-bottom", owl_viewwin_bottom, |
---|
| 982 | OWL_CTX_POPLESS, |
---|
| 983 | "scrolls to the bottom of the buffer", |
---|
| 984 | "", ""), |
---|
| 985 | |
---|
| 986 | OWLCMD_INT_CTX ("popless:scroll-right", owl_viewwin_right, |
---|
| 987 | OWL_CTX_POPLESS, |
---|
| 988 | "scrolls right in the buffer", |
---|
| 989 | "popless:scroll-right <num-chars>", ""), |
---|
| 990 | |
---|
| 991 | OWLCMD_INT_CTX ("popless:scroll-left", owl_viewwin_left, |
---|
| 992 | OWL_CTX_POPLESS, |
---|
| 993 | "scrolls left in the buffer", |
---|
| 994 | "popless:scroll-left <num-chars>", ""), |
---|
| 995 | |
---|
| 996 | OWLCMD_VOID_CTX("popless:quit", owl_command_popless_quit, |
---|
| 997 | OWL_CTX_POPLESS, |
---|
| 998 | "exits the popless window", |
---|
| 999 | "", ""), |
---|
| 1000 | |
---|
[09ceee3] | 1001 | OWLCMD_ARGS_CTX("popless:start-command", owl_viewwin_start_command, |
---|
| 1002 | OWL_CTX_POPLESS, |
---|
| 1003 | "starts a command line in the popless", |
---|
| 1004 | "popless:start-command [initial-value]", |
---|
| 1005 | "Initializes the command field to initial-value"), |
---|
| 1006 | |
---|
[b6cf72f] | 1007 | OWLCMD_ARGS_CTX("popless:search", owl_viewwin_command_search, OWL_CTX_POPLESS, |
---|
| 1008 | "search lines for a particular string", |
---|
| 1009 | "popless:search [-r] [<string>]", |
---|
| 1010 | "The popless:search command will find lines that contain the\n" |
---|
| 1011 | "specified string and scroll the popwin there. If no string\n" |
---|
| 1012 | "argument is supplied then the previous one is used. By\n" |
---|
| 1013 | "default searches are done forwards; if -r is used the search\n" |
---|
| 1014 | "is performed backwards"), |
---|
| 1015 | |
---|
[d2fd2f7] | 1016 | OWLCMD_ARGS_CTX("popless:start-search", owl_viewwin_command_start_search, OWL_CTX_POPLESS, |
---|
| 1017 | "starts a command line to search for particular string", |
---|
| 1018 | "popless:search [-r] [inital-value]", |
---|
| 1019 | "Initializes the command-line to search for initial-value. If\n" |
---|
| 1020 | "-r is used, the search will be performed backwards."), |
---|
| 1021 | |
---|
[0b6b689] | 1022 | OWLCMD_ALIAS("webzephyr", "zwrite daemon.webzephyr -c webzephyr -i"), |
---|
| 1023 | |
---|
[7d4fbcd] | 1024 | /* This line MUST be last! */ |
---|
[bc9020f] | 1025 | { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } |
---|
[7d4fbcd] | 1026 | |
---|
| 1027 | }; |
---|
| 1028 | |
---|
[c79a047] | 1029 | void owl_command_info(void) |
---|
[cf83b7a] | 1030 | { |
---|
[7d4fbcd] | 1031 | owl_function_info(); |
---|
| 1032 | } |
---|
| 1033 | |
---|
[c79a047] | 1034 | void owl_command_nop(void) |
---|
[cf83b7a] | 1035 | { |
---|
[ecd5dc5] | 1036 | } |
---|
| 1037 | |
---|
[e19eb97] | 1038 | char *owl_command_help(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1039 | { |
---|
[7d4fbcd] | 1040 | if (argc!=2) { |
---|
| 1041 | owl_help(); |
---|
| 1042 | return NULL; |
---|
| 1043 | } |
---|
| 1044 | |
---|
| 1045 | owl_function_help_for_command(argv[1]); |
---|
| 1046 | return NULL; |
---|
| 1047 | } |
---|
| 1048 | |
---|
[e19eb97] | 1049 | char *owl_command_zlist(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1050 | { |
---|
[e19eb97] | 1051 | const char *file=NULL; |
---|
[42abb10] | 1052 | |
---|
| 1053 | argc--; |
---|
| 1054 | argv++; |
---|
| 1055 | while (argc) { |
---|
[61de085] | 1056 | if (!strcmp(argv[0], "-f")) { |
---|
[42abb10] | 1057 | if (argc==1) { |
---|
| 1058 | owl_function_makemsg("zlist: -f needs an argument"); |
---|
| 1059 | return(NULL); |
---|
| 1060 | } |
---|
| 1061 | file=argv[1]; |
---|
| 1062 | argc-=2; |
---|
| 1063 | argv+=2; |
---|
| 1064 | } else { |
---|
| 1065 | owl_function_makemsg("zlist: unknown argument"); |
---|
| 1066 | return(NULL); |
---|
| 1067 | } |
---|
| 1068 | } |
---|
[aa5f725] | 1069 | owl_function_buddylist(0, 1, file); |
---|
| 1070 | return(NULL); |
---|
| 1071 | } |
---|
| 1072 | |
---|
[c79a047] | 1073 | void owl_command_alist(void) |
---|
[cf83b7a] | 1074 | { |
---|
[aa5f725] | 1075 | owl_function_buddylist(1, 0, NULL); |
---|
| 1076 | } |
---|
| 1077 | |
---|
[c79a047] | 1078 | void owl_command_blist(void) |
---|
[cf83b7a] | 1079 | { |
---|
[aa5f725] | 1080 | owl_function_buddylist(1, 1, NULL); |
---|
[42abb10] | 1081 | } |
---|
| 1082 | |
---|
[c79a047] | 1083 | void owl_command_toggleoneline(void) |
---|
[cf83b7a] | 1084 | { |
---|
[c3ab155] | 1085 | owl_function_toggleoneline(); |
---|
| 1086 | } |
---|
| 1087 | |
---|
[c79a047] | 1088 | void owl_command_about(void) |
---|
[cf83b7a] | 1089 | { |
---|
[7d4fbcd] | 1090 | owl_function_about(); |
---|
| 1091 | } |
---|
| 1092 | |
---|
[c79a047] | 1093 | void owl_command_version(void) |
---|
[cf83b7a] | 1094 | { |
---|
[554a2b8] | 1095 | owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING); |
---|
[7d4fbcd] | 1096 | } |
---|
| 1097 | |
---|
[e19eb97] | 1098 | char *owl_command_aim(int argc, const char *const *argv, const char *buff) |
---|
[952bb256] | 1099 | { |
---|
| 1100 | if (argc<2) { |
---|
| 1101 | owl_function_makemsg("not enough arguments to aim command"); |
---|
| 1102 | return(NULL); |
---|
| 1103 | } |
---|
| 1104 | |
---|
| 1105 | if (!strcmp(argv[1], "search")) { |
---|
| 1106 | if (argc!=3) { |
---|
| 1107 | owl_function_makemsg("not enough arguments to aim search command"); |
---|
| 1108 | return(NULL); |
---|
| 1109 | } |
---|
| 1110 | owl_aim_search(argv[2]); |
---|
| 1111 | } else { |
---|
[d4b84c0] | 1112 | owl_function_makemsg("unknown subcommand '%s' for aim command", argv[1]); |
---|
[952bb256] | 1113 | return(NULL); |
---|
| 1114 | } |
---|
| 1115 | return(NULL); |
---|
| 1116 | } |
---|
| 1117 | |
---|
[e19eb97] | 1118 | char *owl_command_addbuddy(int argc, const char *const *argv, const char *buff) |
---|
[fd93b41] | 1119 | { |
---|
| 1120 | if (argc!=3) { |
---|
| 1121 | owl_function_makemsg("usage: addbuddy <protocol> <buddyname>"); |
---|
| 1122 | return(NULL); |
---|
| 1123 | } |
---|
| 1124 | |
---|
[65ad073] | 1125 | if (!strcasecmp(argv[1], "aim")) { |
---|
| 1126 | if (!owl_global_is_aimloggedin(&g)) { |
---|
| 1127 | owl_function_makemsg("addbuddy: You must be logged into aim to use this command."); |
---|
| 1128 | return(NULL); |
---|
| 1129 | } |
---|
[03ad7b2] | 1130 | /* |
---|
[aac889a] | 1131 | owl_function_makemsg("This function is not yet operational. Stay tuned."); |
---|
| 1132 | return(NULL); |
---|
[03ad7b2] | 1133 | */ |
---|
[65ad073] | 1134 | owl_aim_addbuddy(argv[2]); |
---|
| 1135 | owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); |
---|
| 1136 | } else if (!strcasecmp(argv[1], "zephyr")) { |
---|
| 1137 | owl_zephyr_addbuddy(argv[2]); |
---|
| 1138 | owl_function_makemsg("%s added as zephyr buddy", argv[2]); |
---|
| 1139 | } else { |
---|
| 1140 | owl_function_makemsg("addbuddy: currently the only supported protocols are 'zephyr' and 'aim'"); |
---|
[fd93b41] | 1141 | } |
---|
| 1142 | |
---|
| 1143 | return(NULL); |
---|
| 1144 | } |
---|
| 1145 | |
---|
[e19eb97] | 1146 | char *owl_command_delbuddy(int argc, const char *const *argv, const char *buff) |
---|
[fd93b41] | 1147 | { |
---|
| 1148 | if (argc!=3) { |
---|
| 1149 | owl_function_makemsg("usage: delbuddy <protocol> <buddyname>"); |
---|
| 1150 | return(NULL); |
---|
| 1151 | } |
---|
| 1152 | |
---|
[65ad073] | 1153 | if (!strcasecmp(argv[1], "aim")) { |
---|
| 1154 | if (!owl_global_is_aimloggedin(&g)) { |
---|
| 1155 | owl_function_makemsg("delbuddy: You must be logged into aim to use this command."); |
---|
| 1156 | return(NULL); |
---|
| 1157 | } |
---|
| 1158 | owl_aim_delbuddy(argv[2]); |
---|
| 1159 | owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); |
---|
| 1160 | } else if (!strcasecmp(argv[1], "zephyr")) { |
---|
| 1161 | owl_zephyr_delbuddy(argv[2]); |
---|
| 1162 | owl_function_makemsg("%s deleted as zephyr buddy", argv[2]); |
---|
| 1163 | } else { |
---|
| 1164 | owl_function_makemsg("delbuddy: currently the only supported protocols are 'zephyr' and 'aim'"); |
---|
[fd93b41] | 1165 | } |
---|
| 1166 | |
---|
[8c92848] | 1167 | return(NULL); |
---|
| 1168 | } |
---|
[fd93b41] | 1169 | |
---|
[e19eb97] | 1170 | char *owl_command_join(int argc, const char *const *argv, const char *buff) |
---|
[8c92848] | 1171 | { |
---|
| 1172 | if (argc!=3 && argc!=4) { |
---|
| 1173 | owl_function_makemsg("usage: join <protocol> <buddyname> [exchange]"); |
---|
| 1174 | return(NULL); |
---|
| 1175 | } |
---|
| 1176 | |
---|
| 1177 | if (!strcasecmp(argv[1], "aim")) { |
---|
| 1178 | if (!owl_global_is_aimloggedin(&g)) { |
---|
| 1179 | owl_function_makemsg("join aim: You must be logged into aim to use this command."); |
---|
| 1180 | return(NULL); |
---|
| 1181 | } |
---|
| 1182 | if (argc==3) { |
---|
| 1183 | owl_aim_chat_join(argv[2], 4); |
---|
| 1184 | } else { |
---|
| 1185 | owl_aim_chat_join(argv[2], atoi(argv[3])); |
---|
| 1186 | } |
---|
| 1187 | /* owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); */ |
---|
| 1188 | } else { |
---|
| 1189 | owl_function_makemsg("join: currently the only supported protocol is 'aim'"); |
---|
| 1190 | } |
---|
[fd93b41] | 1191 | return(NULL); |
---|
| 1192 | } |
---|
| 1193 | |
---|
[e19eb97] | 1194 | char *owl_command_startup(int argc, const char *const *argv, const char *buff) |
---|
[38cf544c] | 1195 | { |
---|
[e19eb97] | 1196 | const char *ptr; |
---|
[38cf544c] | 1197 | |
---|
| 1198 | if (argc<2) { |
---|
| 1199 | owl_function_makemsg("usage: %s <commands> ...", argv[0]); |
---|
| 1200 | return(NULL); |
---|
| 1201 | } |
---|
| 1202 | |
---|
[3e96ff0] | 1203 | ptr = skiptokens(buff, 1); |
---|
[38cf544c] | 1204 | |
---|
[3e96ff0] | 1205 | owl_function_command(ptr); |
---|
| 1206 | owl_function_addstartup(ptr); |
---|
[38cf544c] | 1207 | |
---|
| 1208 | return(NULL); |
---|
| 1209 | } |
---|
| 1210 | |
---|
[e19eb97] | 1211 | char *owl_command_unstartup(int argc, const char *const *argv, const char *buff) |
---|
[38cf544c] | 1212 | { |
---|
[e19eb97] | 1213 | const char *ptr; |
---|
[38cf544c] | 1214 | |
---|
| 1215 | if (argc<2) { |
---|
| 1216 | owl_function_makemsg("usage: %s <commands> ...", argv[0]); |
---|
| 1217 | return(NULL); |
---|
| 1218 | } |
---|
| 1219 | |
---|
[3e96ff0] | 1220 | ptr = skiptokens(buff, 1); |
---|
[38cf544c] | 1221 | |
---|
[3e96ff0] | 1222 | owl_function_delstartup(ptr); |
---|
[38cf544c] | 1223 | |
---|
| 1224 | return(NULL); |
---|
| 1225 | } |
---|
| 1226 | |
---|
[e19eb97] | 1227 | char *owl_command_dump(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1228 | { |
---|
[f36222f] | 1229 | char *filename; |
---|
| 1230 | |
---|
[2adaf1d] | 1231 | if (argc!=2) { |
---|
| 1232 | owl_function_makemsg("usage: dump <filename>"); |
---|
| 1233 | return(NULL); |
---|
| 1234 | } |
---|
[f36222f] | 1235 | filename=owl_util_makepath(argv[1]); |
---|
| 1236 | owl_function_dump(filename); |
---|
| 1237 | owl_free(filename); |
---|
[2adaf1d] | 1238 | return(NULL); |
---|
| 1239 | } |
---|
| 1240 | |
---|
[e19eb97] | 1241 | char *owl_command_source(int argc, const char *const *argv, const char *buff) |
---|
[2404c3a] | 1242 | { |
---|
| 1243 | if (argc!=2) { |
---|
| 1244 | owl_function_makemsg("usage: source <filename>"); |
---|
| 1245 | return(NULL); |
---|
| 1246 | } |
---|
| 1247 | |
---|
| 1248 | owl_function_source(argv[1]); |
---|
| 1249 | return(NULL); |
---|
| 1250 | } |
---|
| 1251 | |
---|
[e19eb97] | 1252 | char *owl_command_next(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1253 | { |
---|
[b950088] | 1254 | char *filter=NULL; |
---|
| 1255 | int skip_deleted=0, last_if_none=0; |
---|
| 1256 | while (argc>1) { |
---|
| 1257 | if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) { |
---|
| 1258 | skip_deleted=1; |
---|
| 1259 | argc-=1; argv+=1; |
---|
| 1260 | } else if (argc>=1 && !strcmp(argv[1], "--last-if-none")) { |
---|
| 1261 | last_if_none=1; |
---|
| 1262 | argc-=1; argv+=1; |
---|
| 1263 | } else if (argc>=2 && !strcmp(argv[1], "--filter")) { |
---|
[7360fab] | 1264 | filter = owl_strdup(argv[2]); |
---|
| 1265 | argc-=2; argv+=2; |
---|
| 1266 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { |
---|
[8a5b5a1] | 1267 | filter = owl_function_smartfilter(0, 0); |
---|
[7360fab] | 1268 | argc-=2; argv+=2; |
---|
| 1269 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { |
---|
[8a5b5a1] | 1270 | filter = owl_function_smartfilter(1, 0); |
---|
[b950088] | 1271 | argc-=2; argv+=2; |
---|
| 1272 | } else { |
---|
| 1273 | owl_function_makemsg("Invalid arguments to command 'next'."); |
---|
| 1274 | return(NULL); |
---|
| 1275 | } |
---|
| 1276 | } |
---|
| 1277 | owl_function_nextmsg_full(filter, skip_deleted, last_if_none); |
---|
[7360fab] | 1278 | if (filter) owl_free(filter); |
---|
[b950088] | 1279 | return(NULL); |
---|
[7d4fbcd] | 1280 | } |
---|
| 1281 | |
---|
[e19eb97] | 1282 | char *owl_command_prev(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1283 | { |
---|
[b950088] | 1284 | char *filter=NULL; |
---|
| 1285 | int skip_deleted=0, first_if_none=0; |
---|
| 1286 | while (argc>1) { |
---|
| 1287 | if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) { |
---|
| 1288 | skip_deleted=1; |
---|
| 1289 | argc-=1; argv+=1; |
---|
| 1290 | } else if (argc>=1 && !strcmp(argv[1], "--first-if-none")) { |
---|
| 1291 | first_if_none=1; |
---|
| 1292 | argc-=1; argv+=1; |
---|
| 1293 | } else if (argc>=2 && !strcmp(argv[1], "--filter")) { |
---|
[7360fab] | 1294 | filter = owl_strdup(argv[2]); |
---|
[b950088] | 1295 | argc-=2; argv+=2; |
---|
[7360fab] | 1296 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { |
---|
[8a5b5a1] | 1297 | filter = owl_function_smartfilter(0, 0); |
---|
[7360fab] | 1298 | argc-=2; argv+=2; |
---|
| 1299 | } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { |
---|
[8a5b5a1] | 1300 | filter = owl_function_smartfilter(1, 0); |
---|
[7360fab] | 1301 | argc-=2; argv+=2; |
---|
| 1302 | } else { |
---|
[b950088] | 1303 | owl_function_makemsg("Invalid arguments to command 'prev'."); |
---|
| 1304 | return(NULL); |
---|
| 1305 | } |
---|
| 1306 | } |
---|
| 1307 | owl_function_prevmsg_full(filter, skip_deleted, first_if_none); |
---|
[7360fab] | 1308 | if (filter) owl_free(filter); |
---|
[b950088] | 1309 | return(NULL); |
---|
[7d4fbcd] | 1310 | } |
---|
| 1311 | |
---|
[e19eb97] | 1312 | char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1313 | { |
---|
[7360fab] | 1314 | char *filtname = NULL; |
---|
| 1315 | |
---|
[8a5b5a1] | 1316 | char opt; |
---|
| 1317 | int instance = 0, related = 0, i; |
---|
[447435a] | 1318 | const char **tmp_argv = owl_malloc(sizeof(char *) * argc); |
---|
[8a5b5a1] | 1319 | |
---|
| 1320 | for (i = 0; i < argc; i++) |
---|
[88e425f] | 1321 | tmp_argv[i] = argv[i]; |
---|
[8a5b5a1] | 1322 | |
---|
[447435a] | 1323 | static const struct option options[] = { |
---|
[8a5b5a1] | 1324 | {"instance", 0, 0, 'i'}, |
---|
| 1325 | {"related", 0, 0, 'r'}, |
---|
| 1326 | {NULL, 0, 0, 0}}; |
---|
[e54a746] | 1327 | |
---|
| 1328 | optind = 0; |
---|
[447435a] | 1329 | while ((opt = getopt_long(argc, (char **)tmp_argv, "ir", options, NULL)) != -1) { |
---|
[8a5b5a1] | 1330 | switch (opt) { |
---|
| 1331 | case 'i': |
---|
| 1332 | instance = 1; |
---|
| 1333 | break; |
---|
| 1334 | case 'r': |
---|
| 1335 | related = 1; |
---|
| 1336 | break; |
---|
| 1337 | default: |
---|
| 1338 | owl_function_makemsg("Wrong number of arguments for %s (%c)", argv[0], opt); |
---|
| 1339 | goto done; |
---|
| 1340 | } |
---|
[7d4fbcd] | 1341 | } |
---|
[8a5b5a1] | 1342 | |
---|
| 1343 | filtname = owl_function_smartfilter(instance, related); |
---|
| 1344 | |
---|
[7360fab] | 1345 | if (filtname) { |
---|
[3895e23] | 1346 | owl_function_change_currentview_filter(filtname); |
---|
[7360fab] | 1347 | owl_free(filtname); |
---|
| 1348 | } |
---|
[8a5b5a1] | 1349 | |
---|
| 1350 | done: |
---|
[88e425f] | 1351 | owl_free(tmp_argv); |
---|
| 1352 | |
---|
[7d4fbcd] | 1353 | return NULL; |
---|
| 1354 | } |
---|
| 1355 | |
---|
[e19eb97] | 1356 | char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1357 | { |
---|
[7360fab] | 1358 | char *filtname = NULL; |
---|
| 1359 | |
---|
| 1360 | if (argc == 1) { |
---|
[8a5b5a1] | 1361 | filtname = owl_function_smartfilter(0, 0); |
---|
[7360fab] | 1362 | } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { |
---|
[8a5b5a1] | 1363 | filtname = owl_function_smartfilter(1, 0); |
---|
[7360fab] | 1364 | } else { |
---|
| 1365 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 1366 | } |
---|
| 1367 | return filtname; |
---|
| 1368 | } |
---|
| 1369 | |
---|
[c79a047] | 1370 | void owl_command_expunge(void) |
---|
[cf83b7a] | 1371 | { |
---|
[7d4fbcd] | 1372 | owl_function_expunge(); |
---|
| 1373 | } |
---|
| 1374 | |
---|
[c79a047] | 1375 | void owl_command_first(void) |
---|
[cf83b7a] | 1376 | { |
---|
[7d4fbcd] | 1377 | owl_global_set_rightshift(&g, 0); |
---|
| 1378 | owl_function_firstmsg(); |
---|
| 1379 | } |
---|
| 1380 | |
---|
[c79a047] | 1381 | void owl_command_last(void) |
---|
[cf83b7a] | 1382 | { |
---|
[7d4fbcd] | 1383 | owl_function_lastmsg(); |
---|
| 1384 | } |
---|
| 1385 | |
---|
[c79a047] | 1386 | void owl_command_resize(void) |
---|
[cf83b7a] | 1387 | { |
---|
[7d4fbcd] | 1388 | owl_function_resize(); |
---|
| 1389 | } |
---|
| 1390 | |
---|
[c79a047] | 1391 | void owl_command_redisplay(void) |
---|
[cf83b7a] | 1392 | { |
---|
[7d4fbcd] | 1393 | owl_function_full_redisplay(); |
---|
| 1394 | } |
---|
| 1395 | |
---|
[8c97fa1] | 1396 | char *owl_command_get_shift(int argc, const char *const *argv, const char *buff) |
---|
| 1397 | { |
---|
| 1398 | if(argc != 1) |
---|
| 1399 | { |
---|
| 1400 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 1401 | return NULL; |
---|
| 1402 | } |
---|
| 1403 | return owl_sprintf("%d", owl_global_get_rightshift(&g)); |
---|
| 1404 | } |
---|
| 1405 | |
---|
| 1406 | void owl_command_set_shift(int shift) |
---|
| 1407 | { |
---|
| 1408 | owl_global_set_rightshift(&g, shift); |
---|
| 1409 | } |
---|
| 1410 | |
---|
[c79a047] | 1411 | void owl_command_unsuball(void) |
---|
[cf83b7a] | 1412 | { |
---|
[7d4fbcd] | 1413 | owl_function_unsuball(); |
---|
| 1414 | } |
---|
| 1415 | |
---|
[e19eb97] | 1416 | char *owl_command_loadsubs(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1417 | { |
---|
[7d4fbcd] | 1418 | if (argc == 2) { |
---|
| 1419 | owl_function_loadsubs(argv[1]); |
---|
| 1420 | } else if (argc == 1) { |
---|
| 1421 | owl_function_loadsubs(NULL); |
---|
| 1422 | } else { |
---|
| 1423 | owl_function_makemsg("Wrong number of arguments for load-subs."); |
---|
[7933748] | 1424 | return(NULL); |
---|
[7d4fbcd] | 1425 | } |
---|
[7933748] | 1426 | return(NULL); |
---|
| 1427 | } |
---|
| 1428 | |
---|
| 1429 | |
---|
[e19eb97] | 1430 | char *owl_command_loadloginsubs(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1431 | { |
---|
[7933748] | 1432 | if (argc == 2) { |
---|
| 1433 | owl_function_loadloginsubs(argv[1]); |
---|
| 1434 | } else if (argc == 1) { |
---|
| 1435 | owl_function_loadloginsubs(NULL); |
---|
| 1436 | } else { |
---|
| 1437 | owl_function_makemsg("Wrong number of arguments for load-subs."); |
---|
| 1438 | return(NULL); |
---|
| 1439 | } |
---|
| 1440 | return(NULL); |
---|
[7d4fbcd] | 1441 | } |
---|
| 1442 | |
---|
[c79a047] | 1443 | void owl_command_suspend(void) |
---|
[cf83b7a] | 1444 | { |
---|
[7d4fbcd] | 1445 | owl_function_suspend(); |
---|
| 1446 | } |
---|
| 1447 | |
---|
[e19eb97] | 1448 | char *owl_command_start_command(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1449 | { |
---|
[7d4fbcd] | 1450 | buff = skiptokens(buff, 1); |
---|
| 1451 | owl_function_start_command(buff); |
---|
[cf83b7a] | 1452 | return(NULL); |
---|
[7d4fbcd] | 1453 | } |
---|
| 1454 | |
---|
[e19eb97] | 1455 | char *owl_command_zaway(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1456 | { |
---|
[7d4fbcd] | 1457 | if ((argc==1) || |
---|
| 1458 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
| 1459 | owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); |
---|
| 1460 | owl_function_zaway_on(); |
---|
| 1461 | return NULL; |
---|
| 1462 | } |
---|
| 1463 | |
---|
| 1464 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
| 1465 | owl_function_zaway_off(); |
---|
| 1466 | return NULL; |
---|
| 1467 | } |
---|
| 1468 | |
---|
| 1469 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
| 1470 | owl_function_zaway_toggle(); |
---|
| 1471 | return NULL; |
---|
| 1472 | } |
---|
| 1473 | |
---|
| 1474 | buff = skiptokens(buff, 1); |
---|
| 1475 | owl_global_set_zaway_msg(&g, buff); |
---|
| 1476 | owl_function_zaway_on(); |
---|
| 1477 | return NULL; |
---|
| 1478 | } |
---|
| 1479 | |
---|
| 1480 | |
---|
[e19eb97] | 1481 | char *owl_command_aaway(int argc, const char *const *argv, const char *buff) |
---|
[4b660cc] | 1482 | { |
---|
| 1483 | if ((argc==1) || |
---|
| 1484 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
| 1485 | owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g)); |
---|
| 1486 | owl_function_aaway_on(); |
---|
| 1487 | return NULL; |
---|
| 1488 | } |
---|
| 1489 | |
---|
| 1490 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
| 1491 | owl_function_aaway_off(); |
---|
| 1492 | return NULL; |
---|
| 1493 | } |
---|
| 1494 | |
---|
| 1495 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
| 1496 | owl_function_aaway_toggle(); |
---|
| 1497 | return NULL; |
---|
| 1498 | } |
---|
| 1499 | |
---|
| 1500 | buff = skiptokens(buff, 1); |
---|
| 1501 | owl_global_set_aaway_msg(&g, buff); |
---|
| 1502 | owl_function_aaway_on(); |
---|
| 1503 | return NULL; |
---|
| 1504 | } |
---|
| 1505 | |
---|
| 1506 | |
---|
[e19eb97] | 1507 | char *owl_command_away(int argc, const char *const *argv, const char *buff) |
---|
[4b660cc] | 1508 | { |
---|
[8ba37ec] | 1509 | if ((argc==1) || |
---|
| 1510 | ((argc==2) && !strcmp(argv[1], "on"))) { |
---|
| 1511 | owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g)); |
---|
| 1512 | owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); |
---|
| 1513 | owl_function_aaway_on(); |
---|
| 1514 | owl_function_zaway_on(); |
---|
[2b237308] | 1515 | owl_function_makemsg("Away messages set."); |
---|
[8ba37ec] | 1516 | return NULL; |
---|
| 1517 | } |
---|
| 1518 | |
---|
| 1519 | if (argc==2 && !strcmp(argv[1], "off")) { |
---|
| 1520 | owl_function_aaway_off(); |
---|
| 1521 | owl_function_zaway_off(); |
---|
| 1522 | return NULL; |
---|
| 1523 | } |
---|
| 1524 | |
---|
| 1525 | if (argc==2 && !strcmp(argv[1], "toggle")) { |
---|
| 1526 | /* if either one is on, turn it off, otherwise toggle both (turn |
---|
| 1527 | * them both on) |
---|
| 1528 | */ |
---|
| 1529 | if (!owl_global_is_zaway(&g) && !owl_global_is_aaway(&g)) { |
---|
| 1530 | owl_function_aaway_toggle(); |
---|
| 1531 | owl_function_zaway_toggle(); |
---|
| 1532 | owl_function_makemsg("Away messages set."); |
---|
| 1533 | } else { |
---|
| 1534 | if (owl_global_is_zaway(&g)) owl_function_zaway_toggle(); |
---|
| 1535 | if (owl_global_is_aaway(&g)) owl_function_aaway_toggle(); |
---|
| 1536 | owl_function_makemsg("Away messages off."); |
---|
| 1537 | } |
---|
| 1538 | return NULL; |
---|
| 1539 | } |
---|
| 1540 | |
---|
| 1541 | buff = skiptokens(buff, 1); |
---|
| 1542 | owl_global_set_aaway_msg(&g, buff); |
---|
| 1543 | owl_global_set_zaway_msg(&g, buff); |
---|
| 1544 | owl_function_aaway_on(); |
---|
| 1545 | owl_function_zaway_on(); |
---|
| 1546 | owl_function_makemsg("Away messages set."); |
---|
[4b660cc] | 1547 | return NULL; |
---|
| 1548 | } |
---|
| 1549 | |
---|
[e19eb97] | 1550 | char *owl_command_set(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1551 | { |
---|
[e19eb97] | 1552 | const char *var, *val; |
---|
[7d4fbcd] | 1553 | int silent=0; |
---|
[486688f] | 1554 | int requirebool=0; |
---|
[7d4fbcd] | 1555 | |
---|
| 1556 | if (argc == 1) { |
---|
| 1557 | owl_function_printallvars(); |
---|
| 1558 | return NULL; |
---|
[486688f] | 1559 | } |
---|
| 1560 | |
---|
| 1561 | if (argc > 1 && !strcmp("-q",argv[1])) { |
---|
[7d4fbcd] | 1562 | silent = 1; |
---|
[486688f] | 1563 | argc--; argv++; |
---|
| 1564 | } |
---|
| 1565 | |
---|
| 1566 | if (argc == 2) { |
---|
| 1567 | var=argv[1]; |
---|
| 1568 | val="on"; |
---|
| 1569 | requirebool=1; |
---|
[7d4fbcd] | 1570 | } else if (argc == 3) { |
---|
| 1571 | var=argv[1]; |
---|
| 1572 | val=argv[2]; |
---|
| 1573 | } else { |
---|
| 1574 | owl_function_makemsg("Wrong number of arguments for set command"); |
---|
| 1575 | return NULL; |
---|
| 1576 | } |
---|
[486688f] | 1577 | owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool); |
---|
| 1578 | return NULL; |
---|
| 1579 | } |
---|
[7d4fbcd] | 1580 | |
---|
[e19eb97] | 1581 | char *owl_command_unset(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1582 | { |
---|
[e19eb97] | 1583 | const char *var, *val; |
---|
[486688f] | 1584 | int silent=0; |
---|
| 1585 | |
---|
| 1586 | if (argc > 1 && !strcmp("-q",argv[1])) { |
---|
| 1587 | silent = 1; |
---|
| 1588 | argc--; argv++; |
---|
| 1589 | } |
---|
| 1590 | if (argc == 2) { |
---|
| 1591 | var=argv[1]; |
---|
| 1592 | val="off"; |
---|
| 1593 | } else { |
---|
| 1594 | owl_function_makemsg("Wrong number of arguments for unset command"); |
---|
| 1595 | return NULL; |
---|
| 1596 | } |
---|
| 1597 | owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1); |
---|
[7d4fbcd] | 1598 | return NULL; |
---|
| 1599 | } |
---|
| 1600 | |
---|
[e19eb97] | 1601 | char *owl_command_print(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1602 | { |
---|
[e19eb97] | 1603 | const char *var; |
---|
[7d4fbcd] | 1604 | char valbuff[1024]; |
---|
| 1605 | |
---|
| 1606 | if (argc==1) { |
---|
| 1607 | owl_function_printallvars(); |
---|
| 1608 | return NULL; |
---|
| 1609 | } else if (argc!=2) { |
---|
| 1610 | owl_function_makemsg("Wrong number of arguments for print command"); |
---|
| 1611 | return NULL; |
---|
| 1612 | } |
---|
| 1613 | |
---|
| 1614 | var=argv[1]; |
---|
| 1615 | |
---|
| 1616 | if (0 == owl_variable_get_tostring(owl_global_get_vardict(&g), |
---|
| 1617 | var, valbuff, 1024)) { |
---|
| 1618 | owl_function_makemsg("%s = '%s'", var, valbuff); |
---|
| 1619 | } else { |
---|
| 1620 | owl_function_makemsg("Unknown variable '%s'.", var); |
---|
| 1621 | } |
---|
| 1622 | return NULL; |
---|
| 1623 | } |
---|
| 1624 | |
---|
| 1625 | |
---|
[e19eb97] | 1626 | char *owl_command_exec(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1627 | { |
---|
[7ba9e0de] | 1628 | return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN); |
---|
[7d4fbcd] | 1629 | } |
---|
| 1630 | |
---|
[e19eb97] | 1631 | char *owl_command_pexec(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1632 | { |
---|
[7ba9e0de] | 1633 | return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP); |
---|
[7d4fbcd] | 1634 | } |
---|
| 1635 | |
---|
[e19eb97] | 1636 | char *owl_command_aexec(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1637 | { |
---|
[7ba9e0de] | 1638 | return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG); |
---|
[7d4fbcd] | 1639 | } |
---|
| 1640 | |
---|
[e19eb97] | 1641 | char *owl_command_perl(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1642 | { |
---|
[7ba9e0de] | 1643 | return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN); |
---|
[7d4fbcd] | 1644 | } |
---|
| 1645 | |
---|
[e19eb97] | 1646 | char *owl_command_pperl(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1647 | { |
---|
[7ba9e0de] | 1648 | return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP); |
---|
[7d4fbcd] | 1649 | } |
---|
| 1650 | |
---|
[e19eb97] | 1651 | char *owl_command_aperl(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1652 | { |
---|
[7ba9e0de] | 1653 | return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG); |
---|
[7d4fbcd] | 1654 | } |
---|
| 1655 | |
---|
[e19eb97] | 1656 | char *owl_command_multi(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1657 | { |
---|
[42c2a80] | 1658 | char *lastrv = NULL, *newbuff; |
---|
[7d4fbcd] | 1659 | char **commands; |
---|
| 1660 | int ncommands, i; |
---|
| 1661 | if (argc < 2) { |
---|
| 1662 | owl_function_makemsg("Invalid arguments to 'multi' command."); |
---|
| 1663 | return NULL; |
---|
| 1664 | } |
---|
[42c2a80] | 1665 | newbuff = owl_strdup(skiptokens(buff, 1)); |
---|
[7d4fbcd] | 1666 | if (!strcmp(argv[0], "(")) { |
---|
| 1667 | for (i=strlen(newbuff)-1; i>=0; i--) { |
---|
| 1668 | if (newbuff[i] == ')') { |
---|
| 1669 | newbuff[i] = '\0'; |
---|
| 1670 | break; |
---|
| 1671 | } else if (newbuff[i] != ' ') { |
---|
| 1672 | owl_function_makemsg("Invalid arguments to 'multi' command."); |
---|
| 1673 | owl_free(newbuff); |
---|
| 1674 | return NULL; |
---|
| 1675 | } |
---|
| 1676 | } |
---|
| 1677 | } |
---|
| 1678 | commands = atokenize(newbuff, ";", &ncommands); |
---|
| 1679 | for (i=0; i<ncommands; i++) { |
---|
| 1680 | if (lastrv) { |
---|
| 1681 | owl_free(lastrv); |
---|
| 1682 | } |
---|
| 1683 | lastrv = owl_function_command(commands[i]); |
---|
| 1684 | } |
---|
[42c2a80] | 1685 | owl_free(newbuff); |
---|
[1672650] | 1686 | atokenize_delete(commands, ncommands); |
---|
[7d4fbcd] | 1687 | return lastrv; |
---|
| 1688 | } |
---|
| 1689 | |
---|
| 1690 | |
---|
[e19eb97] | 1691 | char *owl_command_alias(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1692 | { |
---|
[7d4fbcd] | 1693 | if (argc < 3) { |
---|
| 1694 | owl_function_makemsg("Invalid arguments to 'alias' command."); |
---|
| 1695 | return NULL; |
---|
| 1696 | } |
---|
| 1697 | buff = skiptokens(buff, 2); |
---|
| 1698 | owl_function_command_alias(argv[1], buff); |
---|
| 1699 | return (NULL); |
---|
| 1700 | } |
---|
| 1701 | |
---|
| 1702 | |
---|
[e19eb97] | 1703 | char *owl_command_bindkey(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1704 | { |
---|
[7d4fbcd] | 1705 | owl_keymap *km; |
---|
| 1706 | int ret; |
---|
| 1707 | |
---|
| 1708 | if (argc < 5 || strcmp(argv[3], "command")) { |
---|
[f1e629d] | 1709 | owl_function_makemsg("Usage: bindkey <keymap> <binding> command <cmd>"); |
---|
[7d4fbcd] | 1710 | return NULL; |
---|
| 1711 | } |
---|
| 1712 | km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), argv[1]); |
---|
| 1713 | if (!km) { |
---|
| 1714 | owl_function_makemsg("No such keymap '%s'", argv[1]); |
---|
| 1715 | return NULL; |
---|
| 1716 | } |
---|
| 1717 | buff = skiptokens(buff, 4); |
---|
| 1718 | ret = owl_keymap_create_binding(km, argv[2], buff, NULL, "*user*"); |
---|
| 1719 | if (ret!=0) { |
---|
| 1720 | owl_function_makemsg("Unable to bind '%s' in keymap '%s' to '%s'.", |
---|
| 1721 | argv[2], argv[1], buff); |
---|
| 1722 | return NULL; |
---|
| 1723 | } |
---|
| 1724 | return NULL; |
---|
| 1725 | } |
---|
| 1726 | |
---|
[8a921b5] | 1727 | |
---|
[b4a95fc] | 1728 | char *owl_command_unbindkey(int argc, const char *const *argv, const char *buf) |
---|
[8a921b5] | 1729 | { |
---|
| 1730 | owl_keymap *km; |
---|
| 1731 | int ret; |
---|
| 1732 | |
---|
| 1733 | if (argc < 3) { |
---|
| 1734 | owl_function_makemsg("Usage: bindkey <keymap> <binding>"); |
---|
| 1735 | return NULL; |
---|
| 1736 | } |
---|
| 1737 | km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), argv[1]); |
---|
| 1738 | if (!km) { |
---|
| 1739 | owl_function_makemsg("No such keymap '%s'", argv[1]); |
---|
| 1740 | return NULL; |
---|
| 1741 | } |
---|
| 1742 | ret = owl_keymap_remove_binding(km, argv[2]); |
---|
| 1743 | if (ret == -1) { |
---|
| 1744 | owl_function_makemsg("Unable to unbind '%s' in keymap '%s'.", |
---|
| 1745 | argv[2], argv[1]); |
---|
| 1746 | return NULL; |
---|
| 1747 | } else if (ret == -2) { |
---|
| 1748 | owl_function_makemsg("No such binding '%s' in keymap '%s'.", |
---|
| 1749 | argv[2], argv[1]); |
---|
| 1750 | } |
---|
| 1751 | return NULL; |
---|
| 1752 | } |
---|
| 1753 | |
---|
| 1754 | |
---|
[c79a047] | 1755 | void owl_command_quit(void) |
---|
[cf83b7a] | 1756 | { |
---|
[7d4fbcd] | 1757 | owl_function_quit(); |
---|
| 1758 | } |
---|
| 1759 | |
---|
[e19eb97] | 1760 | char *owl_command_debug(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1761 | { |
---|
[7d4fbcd] | 1762 | if (argc<2) { |
---|
| 1763 | owl_function_makemsg("Need at least one argument to debug command"); |
---|
[ecd5dc5] | 1764 | return(NULL); |
---|
[7d4fbcd] | 1765 | } |
---|
| 1766 | |
---|
| 1767 | if (!owl_global_is_debug_fast(&g)) { |
---|
| 1768 | owl_function_makemsg("Debugging is not turned on"); |
---|
[ecd5dc5] | 1769 | return(NULL); |
---|
[7d4fbcd] | 1770 | } |
---|
| 1771 | |
---|
[554a2b8] | 1772 | owl_function_debugmsg("%s", argv[1]); |
---|
[ecd5dc5] | 1773 | return(NULL); |
---|
[7d4fbcd] | 1774 | } |
---|
| 1775 | |
---|
[e19eb97] | 1776 | char *owl_command_term(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1777 | { |
---|
[ecd5dc5] | 1778 | if (argc<2) { |
---|
| 1779 | owl_function_makemsg("Need at least one argument to the term command"); |
---|
| 1780 | return(NULL); |
---|
| 1781 | } |
---|
| 1782 | |
---|
| 1783 | if (!strcmp(argv[1], "raise")) { |
---|
| 1784 | owl_function_xterm_raise(); |
---|
| 1785 | } else if (!strcmp(argv[1], "deiconify")) { |
---|
| 1786 | owl_function_xterm_deiconify(); |
---|
| 1787 | } else { |
---|
[d09e5a1] | 1788 | owl_function_makemsg("Unknown terminal subcommand"); |
---|
[ecd5dc5] | 1789 | } |
---|
| 1790 | return(NULL); |
---|
[7d4fbcd] | 1791 | } |
---|
| 1792 | |
---|
[e19eb97] | 1793 | char *owl_command_zlog(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1794 | { |
---|
[425c013] | 1795 | if ((argc<2) || (argc>3)) { |
---|
[7d4fbcd] | 1796 | owl_function_makemsg("Wrong number of arguments for zlog command"); |
---|
[425c013] | 1797 | return(NULL); |
---|
[7d4fbcd] | 1798 | } |
---|
| 1799 | |
---|
| 1800 | if (!strcmp(argv[1], "in")) { |
---|
[425c013] | 1801 | if (argc>2) { |
---|
| 1802 | owl_global_set_tty(&g, argv[2]); |
---|
| 1803 | } |
---|
[31e48a3] | 1804 | owl_zephyr_zlog_in(); |
---|
[7d4fbcd] | 1805 | } else if (!strcmp(argv[1], "out")) { |
---|
[425c013] | 1806 | if (argc!=2) { |
---|
| 1807 | owl_function_makemsg("Wrong number of arguments for zlog command"); |
---|
| 1808 | return(NULL); |
---|
| 1809 | } |
---|
[31e48a3] | 1810 | owl_zephyr_zlog_out(); |
---|
[7d4fbcd] | 1811 | } else { |
---|
| 1812 | owl_function_makemsg("Invalid subcommand for zlog"); |
---|
| 1813 | } |
---|
[425c013] | 1814 | return(NULL); |
---|
[7d4fbcd] | 1815 | } |
---|
| 1816 | |
---|
[e19eb97] | 1817 | char *owl_command_subscribe(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1818 | { |
---|
[e19eb97] | 1819 | const char *class, *instance, *recip=""; |
---|
[bde7714] | 1820 | int temp=0; |
---|
[3617286] | 1821 | int ret=0; |
---|
[f830d84] | 1822 | |
---|
| 1823 | if (argc < 2) { |
---|
[7d4fbcd] | 1824 | owl_function_makemsg("Not enough arguments to the subscribe command"); |
---|
[bde7714] | 1825 | return(NULL); |
---|
| 1826 | } |
---|
| 1827 | argc--; |
---|
| 1828 | argv++; |
---|
| 1829 | |
---|
| 1830 | if (!strcmp(argv[0], "-t")) { |
---|
| 1831 | temp=1; |
---|
| 1832 | argc--; |
---|
| 1833 | argv++; |
---|
| 1834 | } |
---|
[f830d84] | 1835 | if (argc < 1) { |
---|
[bde7714] | 1836 | owl_function_makemsg("Not enough arguments to the subscribe command"); |
---|
| 1837 | return(NULL); |
---|
| 1838 | } |
---|
| 1839 | |
---|
[f830d84] | 1840 | if (argc > 3) { |
---|
[7d4fbcd] | 1841 | owl_function_makemsg("Too many arguments to the subscribe command"); |
---|
[bde7714] | 1842 | return(NULL); |
---|
[7d4fbcd] | 1843 | } |
---|
| 1844 | |
---|
[f830d84] | 1845 | class = argv[0]; |
---|
| 1846 | |
---|
| 1847 | if (argc == 1) { |
---|
| 1848 | instance = "*"; |
---|
| 1849 | } else { |
---|
| 1850 | instance = argv[1]; |
---|
| 1851 | } |
---|
| 1852 | |
---|
| 1853 | if (argc <= 2) { |
---|
[7d4fbcd] | 1854 | recip=""; |
---|
[bde7714] | 1855 | } else if (argc==3) { |
---|
| 1856 | recip=argv[2]; |
---|
[7d4fbcd] | 1857 | } |
---|
| 1858 | |
---|
[f830d84] | 1859 | ret = owl_function_subscribe(class, instance, recip); |
---|
[3617286] | 1860 | if (!temp && !ret) { |
---|
[f830d84] | 1861 | owl_zephyr_addsub(NULL, class, instance, recip); |
---|
[bde7714] | 1862 | } |
---|
| 1863 | return(NULL); |
---|
[7d4fbcd] | 1864 | } |
---|
| 1865 | |
---|
| 1866 | |
---|
[e19eb97] | 1867 | char *owl_command_unsubscribe(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1868 | { |
---|
[e19eb97] | 1869 | const char *class, *instance, *recip=""; |
---|
[bde7714] | 1870 | int temp=0; |
---|
[7d4fbcd] | 1871 | |
---|
[f830d84] | 1872 | if (argc < 2) { |
---|
[7d4fbcd] | 1873 | owl_function_makemsg("Not enough arguments to the unsubscribe command"); |
---|
[bde7714] | 1874 | return(NULL); |
---|
| 1875 | } |
---|
| 1876 | argc--; |
---|
| 1877 | argv++; |
---|
| 1878 | |
---|
| 1879 | if (!strcmp(argv[0], "-t")) { |
---|
| 1880 | temp=1; |
---|
| 1881 | argc--; |
---|
| 1882 | argv++; |
---|
| 1883 | } |
---|
[f830d84] | 1884 | if (argc < 1) { |
---|
| 1885 | owl_function_makemsg("Not enough arguments to the unsubscribe command"); |
---|
[bde7714] | 1886 | return(NULL); |
---|
| 1887 | } |
---|
| 1888 | |
---|
[f830d84] | 1889 | if (argc > 3) { |
---|
[7d4fbcd] | 1890 | owl_function_makemsg("Too many arguments to the unsubscribe command"); |
---|
[bde7714] | 1891 | return(NULL); |
---|
[7d4fbcd] | 1892 | } |
---|
| 1893 | |
---|
[f830d84] | 1894 | class = argv[0]; |
---|
| 1895 | |
---|
| 1896 | if (argc == 1) { |
---|
| 1897 | instance = "*"; |
---|
| 1898 | } else { |
---|
| 1899 | instance = argv[1]; |
---|
| 1900 | } |
---|
| 1901 | |
---|
| 1902 | if (argc <= 2) { |
---|
[7d4fbcd] | 1903 | recip=""; |
---|
[bde7714] | 1904 | } else if (argc==3) { |
---|
| 1905 | recip=argv[2]; |
---|
[7d4fbcd] | 1906 | } |
---|
| 1907 | |
---|
[f830d84] | 1908 | owl_function_unsubscribe(class, instance, recip); |
---|
[bde7714] | 1909 | if (!temp) { |
---|
[f830d84] | 1910 | owl_zephyr_delsub(NULL, class, instance, recip); |
---|
[bde7714] | 1911 | } |
---|
| 1912 | return(NULL); |
---|
[7d4fbcd] | 1913 | } |
---|
| 1914 | |
---|
[e19eb97] | 1915 | char *owl_command_echo(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1916 | { |
---|
[7d4fbcd] | 1917 | buff = skiptokens(buff, 1); |
---|
| 1918 | owl_function_popless_text(buff); |
---|
| 1919 | return NULL; |
---|
| 1920 | } |
---|
| 1921 | |
---|
[cf83b7a] | 1922 | void owl_command_getsubs(void) |
---|
| 1923 | { |
---|
[7d4fbcd] | 1924 | owl_function_getsubs(); |
---|
| 1925 | } |
---|
| 1926 | |
---|
[cf83b7a] | 1927 | void owl_command_status(void) |
---|
| 1928 | { |
---|
[7d4fbcd] | 1929 | owl_function_status(); |
---|
| 1930 | } |
---|
| 1931 | |
---|
[e19eb97] | 1932 | char *owl_command_zwrite(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1933 | { |
---|
[987cf3f] | 1934 | owl_zwrite *z; |
---|
[1c6c4d3] | 1935 | |
---|
[5b85d19] | 1936 | if (!owl_global_is_havezephyr(&g)) { |
---|
| 1937 | owl_function_makemsg("Zephyr is not available"); |
---|
| 1938 | return(NULL); |
---|
| 1939 | } |
---|
[1c6c4d3] | 1940 | /* check for a zwrite -m */ |
---|
[987cf3f] | 1941 | z = owl_zwrite_new(buff); |
---|
| 1942 | if (!z) { |
---|
| 1943 | owl_function_error("Error in zwrite arguments"); |
---|
| 1944 | return NULL; |
---|
| 1945 | } |
---|
| 1946 | |
---|
| 1947 | if (owl_zwrite_is_message_set(z)) { |
---|
| 1948 | owl_function_zwrite(z, NULL); |
---|
| 1949 | owl_zwrite_delete(z); |
---|
| 1950 | return NULL; |
---|
[1c6c4d3] | 1951 | } |
---|
| 1952 | |
---|
[7d4fbcd] | 1953 | if (argc < 2) { |
---|
[987cf3f] | 1954 | owl_zwrite_delete(z); |
---|
[7d4fbcd] | 1955 | owl_function_makemsg("Not enough arguments to the zwrite command."); |
---|
| 1956 | } else { |
---|
[987cf3f] | 1957 | owl_function_zwrite_setup(z); |
---|
[7d4fbcd] | 1958 | } |
---|
[ce7db4d] | 1959 | return(NULL); |
---|
[7d4fbcd] | 1960 | } |
---|
| 1961 | |
---|
[e19eb97] | 1962 | char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 1963 | { |
---|
[65b2173] | 1964 | char *newbuff, *recip; |
---|
[e19eb97] | 1965 | const char *const *myargv; |
---|
[944004c] | 1966 | int i, j, myargc; |
---|
[fa4f9c3] | 1967 | owl_message *m; |
---|
[658dc2f] | 1968 | |
---|
[aa5f725] | 1969 | if (!owl_global_is_aimloggedin(&g)) { |
---|
| 1970 | owl_function_makemsg("You are not logged in to AIM."); |
---|
| 1971 | return(NULL); |
---|
| 1972 | } |
---|
| 1973 | |
---|
[d09e5a1] | 1974 | if (argc < 2) { |
---|
| 1975 | owl_function_makemsg("Not enough arguments to the aimwrite command."); |
---|
[aa5f725] | 1976 | return(NULL); |
---|
[d09e5a1] | 1977 | } |
---|
[aa5f725] | 1978 | |
---|
[944004c] | 1979 | myargv=argv; |
---|
| 1980 | if (argc<0) { |
---|
| 1981 | owl_function_error("Unbalanced quotes in aimwrite"); |
---|
| 1982 | return(NULL); |
---|
| 1983 | } |
---|
| 1984 | myargc=argc; |
---|
| 1985 | if (myargc && *(myargv[0])!='-') { |
---|
| 1986 | myargc--; |
---|
| 1987 | myargv++; |
---|
| 1988 | } |
---|
| 1989 | while (myargc) { |
---|
| 1990 | if (!strcmp(myargv[0], "-m")) { |
---|
| 1991 | if (myargc<2) { |
---|
| 1992 | break; |
---|
| 1993 | } |
---|
| 1994 | |
---|
| 1995 | /* Once we have -m, gobble up everything else on the line */ |
---|
| 1996 | myargv++; |
---|
| 1997 | myargc--; |
---|
| 1998 | newbuff=owl_strdup(""); |
---|
| 1999 | while (myargc) { |
---|
[27f6487] | 2000 | newbuff=owl_realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5); |
---|
[944004c] | 2001 | strcat(newbuff, myargv[0]); |
---|
| 2002 | strcat(newbuff, " "); |
---|
| 2003 | myargc--; |
---|
| 2004 | myargv++; |
---|
| 2005 | } |
---|
[4083c49] | 2006 | if (strlen(newbuff) >= 1) |
---|
| 2007 | newbuff[strlen(newbuff) - 1] = '\0'; /* remove last space */ |
---|
[944004c] | 2008 | |
---|
[181ea08] | 2009 | recip=owl_strdup(argv[1]); |
---|
[944004c] | 2010 | owl_aim_send_im(recip, newbuff); |
---|
[fa4f9c3] | 2011 | m=owl_function_make_outgoing_aim(newbuff, recip); |
---|
| 2012 | if (m) { |
---|
| 2013 | owl_global_messagequeue_addmsg(&g, m); |
---|
| 2014 | } else { |
---|
| 2015 | owl_function_error("Could not create outgoing AIM message"); |
---|
| 2016 | } |
---|
| 2017 | |
---|
[944004c] | 2018 | owl_free(recip); |
---|
| 2019 | owl_free(newbuff); |
---|
| 2020 | return(NULL); |
---|
| 2021 | } else { |
---|
| 2022 | /* we don't care */ |
---|
| 2023 | myargv++; |
---|
| 2024 | myargc--; |
---|
| 2025 | } |
---|
| 2026 | } |
---|
| 2027 | |
---|
[658dc2f] | 2028 | /* squish arguments together to make one screenname w/o spaces for now */ |
---|
| 2029 | newbuff=owl_malloc(strlen(buff)+5); |
---|
| 2030 | sprintf(newbuff, "%s ", argv[0]); |
---|
| 2031 | j=argc-1; |
---|
| 2032 | for (i=0; i<j; i++) { |
---|
| 2033 | strcat(newbuff, argv[i+1]); |
---|
| 2034 | } |
---|
| 2035 | |
---|
| 2036 | owl_function_aimwrite_setup(newbuff); |
---|
| 2037 | owl_free(newbuff); |
---|
[aa5f725] | 2038 | return(NULL); |
---|
[d09e5a1] | 2039 | } |
---|
| 2040 | |
---|
[e19eb97] | 2041 | char *owl_command_loopwrite(int argc, const char *const *argv, const char *buff) |
---|
[37eab7f] | 2042 | { |
---|
| 2043 | owl_function_loopwrite_setup(); |
---|
| 2044 | return(NULL); |
---|
| 2045 | } |
---|
| 2046 | |
---|
[e19eb97] | 2047 | char *owl_command_reply(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2048 | { |
---|
[7d4fbcd] | 2049 | int edit=0; |
---|
| 2050 | |
---|
[8df36cc] | 2051 | if (argc>=2 && !strcmp("-e", argv[1])) { |
---|
[7d4fbcd] | 2052 | edit=1; |
---|
| 2053 | argv++; |
---|
[217a43e] | 2054 | argc--; |
---|
[7d4fbcd] | 2055 | } |
---|
| 2056 | |
---|
| 2057 | if ((argc==1) || (argc==2 && !strcmp(argv[1], "all"))) { |
---|
| 2058 | owl_function_reply(0, !edit); |
---|
[e75011e] | 2059 | } else if (argc==2 && !strcmp(argv[1], "sender")) { |
---|
[7d4fbcd] | 2060 | owl_function_reply(1, !edit); |
---|
[e75011e] | 2061 | } else if (argc==2 && !strcmp(argv[1], "zaway")) { |
---|
[c08c70a] | 2062 | const owl_message *m; |
---|
[9e5c9f3] | 2063 | const owl_view *v; |
---|
[e75011e] | 2064 | v = owl_global_get_current_view(&g); |
---|
| 2065 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
| 2066 | if (m) owl_zephyr_zaway(m); |
---|
[7d4fbcd] | 2067 | } else { |
---|
| 2068 | owl_function_makemsg("Invalid arguments to the reply command."); |
---|
| 2069 | } |
---|
| 2070 | return NULL; |
---|
| 2071 | } |
---|
| 2072 | |
---|
[e19eb97] | 2073 | char *owl_command_filter(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2074 | { |
---|
[7d4fbcd] | 2075 | owl_function_create_filter(argc, argv); |
---|
| 2076 | return NULL; |
---|
| 2077 | } |
---|
| 2078 | |
---|
[e19eb97] | 2079 | char *owl_command_zlocate(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2080 | { |
---|
[2527615] | 2081 | int auth; |
---|
| 2082 | |
---|
| 2083 | if (argc<2) { |
---|
| 2084 | owl_function_makemsg("Too few arguments for zlocate command"); |
---|
| 2085 | return NULL; |
---|
| 2086 | } |
---|
| 2087 | |
---|
| 2088 | auth=1; |
---|
| 2089 | if (!strcmp(argv[1], "-d")) { |
---|
| 2090 | if (argc>2) { |
---|
| 2091 | auth=0; |
---|
| 2092 | argc--; |
---|
| 2093 | argv++; |
---|
[7d4fbcd] | 2094 | } else { |
---|
[2527615] | 2095 | owl_function_makemsg("Missing arguments for zlocate command"); |
---|
[7d4fbcd] | 2096 | return NULL; |
---|
| 2097 | } |
---|
| 2098 | } |
---|
[2527615] | 2099 | |
---|
| 2100 | argc--; |
---|
| 2101 | argv++; |
---|
| 2102 | owl_function_zlocate(argc, argv, auth); |
---|
[7d4fbcd] | 2103 | return NULL; |
---|
| 2104 | } |
---|
| 2105 | |
---|
[3895e23] | 2106 | |
---|
| 2107 | /* Backwards compatability has made this kind of complicated: |
---|
| 2108 | * view [<viewname>] [-f <filter> | -d <expression> | --home | -r ] [-s <style>] |
---|
| 2109 | * view <filter> |
---|
| 2110 | * view -d <expression> |
---|
| 2111 | * view --home |
---|
| 2112 | */ |
---|
[e19eb97] | 2113 | char *owl_command_view(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2114 | { |
---|
[3895e23] | 2115 | /* First take the 'view --home' and 'view -r' cases */ |
---|
| 2116 | if (argc == 2) { |
---|
| 2117 | if (!strcmp(argv[1], "--home")) { |
---|
| 2118 | owl_function_change_currentview_filter(owl_global_get_view_home(&g)); |
---|
| 2119 | return(NULL); |
---|
| 2120 | } else if (!strcmp(argv[1], "-r")) { |
---|
| 2121 | char *foo; |
---|
| 2122 | foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); |
---|
| 2123 | owl_function_change_currentview_filter(foo); |
---|
[c0a90c2] | 2124 | owl_free(foo); |
---|
[3895e23] | 2125 | return(NULL); |
---|
| 2126 | } |
---|
[7d4fbcd] | 2127 | } |
---|
| 2128 | |
---|
[ef56a67] | 2129 | /* Now look for 'view <filter>' */ |
---|
| 2130 | if (argc==2) { |
---|
[3895e23] | 2131 | owl_function_change_currentview_filter(argv[1]); |
---|
[ef56a67] | 2132 | return(NULL); |
---|
| 2133 | } |
---|
| 2134 | |
---|
| 2135 | /* Now get 'view -d <expression>' */ |
---|
[94e4899] | 2136 | if (argc>=3 && !strcmp(argv[1], "-d")) { |
---|
[e19eb97] | 2137 | const char **myargv; |
---|
[7d4fbcd] | 2138 | int i; |
---|
| 2139 | |
---|
[e19eb97] | 2140 | myargv=owl_malloc((argc*sizeof(const char *))+50); |
---|
[7d4fbcd] | 2141 | myargv[0]=""; |
---|
| 2142 | myargv[1]="owl-dynamic"; |
---|
| 2143 | for (i=2; i<argc; i++) { |
---|
| 2144 | myargv[i]=argv[i]; |
---|
| 2145 | } |
---|
| 2146 | owl_function_create_filter(argc, myargv); |
---|
[3895e23] | 2147 | owl_function_change_currentview_filter("owl-dynamic"); |
---|
[7d4fbcd] | 2148 | owl_free(myargv); |
---|
| 2149 | return NULL; |
---|
| 2150 | } |
---|
| 2151 | |
---|
[ef56a67] | 2152 | /* Finally handle the general case */ |
---|
| 2153 | if (argc<3) { |
---|
| 2154 | owl_function_makemsg("Too few arguments to the view command."); |
---|
| 2155 | return(NULL); |
---|
[7d4fbcd] | 2156 | } |
---|
[ef56a67] | 2157 | argc--; |
---|
| 2158 | argv++; |
---|
[3895e23] | 2159 | if (strcmp(argv[0], "-f") && |
---|
| 2160 | strcmp(argv[0], "-d") && |
---|
| 2161 | strcmp(argv[0], "--home") && |
---|
| 2162 | strcmp(argv[0], "-s") && |
---|
| 2163 | strcmp(argv[0], "-r")) { |
---|
[ef56a67] | 2164 | if (strcmp(argv[0], "main")) { |
---|
| 2165 | owl_function_makemsg("No view named '%s'", argv[0]); |
---|
| 2166 | return(NULL); |
---|
| 2167 | } |
---|
| 2168 | argc--; |
---|
| 2169 | argv++; |
---|
| 2170 | } |
---|
| 2171 | while (argc) { |
---|
| 2172 | if (!strcmp(argv[0], "-f")) { |
---|
| 2173 | if (argc<2) { |
---|
| 2174 | owl_function_makemsg("Too few argments to the view command"); |
---|
| 2175 | return(NULL); |
---|
| 2176 | } |
---|
[3895e23] | 2177 | owl_function_change_currentview_filter(argv[1]); |
---|
[ef56a67] | 2178 | argc-=2; |
---|
| 2179 | argv+=2; |
---|
| 2180 | } else if (!strcmp(argv[0], "--home")) { |
---|
[3895e23] | 2181 | owl_function_change_currentview_filter(owl_global_get_view_home(&g)); |
---|
[ef56a67] | 2182 | argc--; |
---|
| 2183 | argv++; |
---|
| 2184 | } else if (!strcmp(argv[0], "-s")) { |
---|
| 2185 | if (argc<2) { |
---|
| 2186 | owl_function_makemsg("Too few argments to the view command"); |
---|
| 2187 | return(NULL); |
---|
| 2188 | } |
---|
| 2189 | owl_function_change_style(owl_global_get_current_view(&g), argv[1]); |
---|
| 2190 | argc-=2; |
---|
| 2191 | argv+=2; |
---|
| 2192 | } else { |
---|
| 2193 | owl_function_makemsg("Too few argments to the view command"); |
---|
| 2194 | return(NULL); |
---|
| 2195 | } |
---|
| 2196 | |
---|
| 2197 | } |
---|
| 2198 | return(NULL); |
---|
[7d4fbcd] | 2199 | } |
---|
| 2200 | |
---|
[e19eb97] | 2201 | char *owl_command_show(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2202 | { |
---|
[7d4fbcd] | 2203 | if (argc<2) { |
---|
| 2204 | owl_function_help_for_command("show"); |
---|
| 2205 | return NULL; |
---|
| 2206 | } |
---|
| 2207 | |
---|
| 2208 | if (!strcmp(argv[1], "filter") || !strcmp(argv[1], "filters")) { |
---|
| 2209 | if (argc==2) { |
---|
| 2210 | owl_function_show_filters(); |
---|
| 2211 | } else { |
---|
| 2212 | owl_function_show_filter(argv[2]); |
---|
| 2213 | } |
---|
| 2214 | } else if (argc==2 |
---|
| 2215 | && (!strcmp(argv[1], "zpunts") || !strcmp(argv[1], "zpunted"))) { |
---|
| 2216 | owl_function_show_zpunts(); |
---|
| 2217 | } else if (!strcmp(argv[1], "command") || !strcmp(argv[1], "commands")) { |
---|
| 2218 | if (argc==2) { |
---|
| 2219 | owl_function_show_commands(); |
---|
| 2220 | } else { |
---|
| 2221 | owl_function_show_command(argv[2]); |
---|
| 2222 | } |
---|
| 2223 | } else if (!strcmp(argv[1], "variable") || !strcmp(argv[1], "variables")) { |
---|
| 2224 | if (argc==2) { |
---|
| 2225 | owl_function_show_variables(); |
---|
| 2226 | } else { |
---|
| 2227 | owl_function_show_variable(argv[2]); |
---|
| 2228 | } |
---|
| 2229 | } else if (!strcmp(argv[1], "keymap") || !strcmp(argv[1], "keymaps")) { |
---|
| 2230 | if (argc==2) { |
---|
| 2231 | owl_function_show_keymaps(); |
---|
| 2232 | } else { |
---|
| 2233 | owl_function_show_keymap(argv[2]); |
---|
| 2234 | } |
---|
[ef56a67] | 2235 | } else if (!strcmp(argv[1], "view")) { |
---|
| 2236 | if (argc==3) { |
---|
| 2237 | owl_function_show_view(argv[2]); |
---|
| 2238 | } else { |
---|
| 2239 | owl_function_show_view(NULL); |
---|
| 2240 | } |
---|
[7d4fbcd] | 2241 | } else if (!strcmp(argv[1], "colors")) { |
---|
| 2242 | owl_function_show_colors(); |
---|
[f1e629d] | 2243 | } else if (!strcmp(argv[1], "styles")) { |
---|
| 2244 | owl_function_show_styles(); |
---|
[7d4fbcd] | 2245 | } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) { |
---|
| 2246 | owl_function_getsubs(); |
---|
| 2247 | } else if (!strcmp(argv[1], "terminal") || !strcmp(argv[1], "term")) { |
---|
| 2248 | owl_function_show_term(); |
---|
| 2249 | } else if (!strcmp(argv[1], "version")) { |
---|
| 2250 | owl_function_about(); |
---|
| 2251 | } else if (!strcmp(argv[1], "status")) { |
---|
| 2252 | owl_function_status(); |
---|
[debb15d] | 2253 | } else if (!strcmp(argv[1], "license")) { |
---|
| 2254 | owl_function_show_license(); |
---|
[799b60e] | 2255 | } else if (!strcmp(argv[1], "quickstart")) { |
---|
| 2256 | owl_function_show_quickstart(); |
---|
[f17bff98] | 2257 | } else if (!strcmp(argv[1], "startup")) { |
---|
[e19eb97] | 2258 | const char *filename; |
---|
[f17bff98] | 2259 | |
---|
[b363d83] | 2260 | filename=owl_global_get_startupfile(&g); |
---|
[f17bff98] | 2261 | owl_function_popless_file(filename); |
---|
[ec6ff52] | 2262 | } else if (!strcmp(argv[1], "errors")) { |
---|
| 2263 | owl_function_showerrs(); |
---|
[7d4fbcd] | 2264 | } else { |
---|
| 2265 | owl_function_makemsg("Unknown subcommand for 'show' command (see 'help show' for allowed args)"); |
---|
| 2266 | return NULL; |
---|
| 2267 | } |
---|
| 2268 | return NULL; |
---|
| 2269 | } |
---|
| 2270 | |
---|
[e19eb97] | 2271 | char *owl_command_viewclass(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2272 | { |
---|
[7360fab] | 2273 | char *filtname; |
---|
[7d4fbcd] | 2274 | if (argc!=2) { |
---|
| 2275 | owl_function_makemsg("Wrong number of arguments to viewclass command"); |
---|
| 2276 | return NULL; |
---|
| 2277 | } |
---|
[66e409c] | 2278 | filtname = owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g)); |
---|
[3895e23] | 2279 | owl_function_change_currentview_filter(filtname); |
---|
[7360fab] | 2280 | owl_free(filtname); |
---|
[7d4fbcd] | 2281 | return NULL; |
---|
| 2282 | } |
---|
| 2283 | |
---|
[e19eb97] | 2284 | char *owl_command_viewuser(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2285 | { |
---|
[7360fab] | 2286 | char *filtname; |
---|
[7d4fbcd] | 2287 | if (argc!=2) { |
---|
| 2288 | owl_function_makemsg("Wrong number of arguments to viewuser command"); |
---|
| 2289 | return NULL; |
---|
| 2290 | } |
---|
[3abf28b] | 2291 | filtname=owl_function_zuserfilt(argv[1]); |
---|
[3895e23] | 2292 | owl_function_change_currentview_filter(filtname); |
---|
[7360fab] | 2293 | owl_free(filtname); |
---|
[7d4fbcd] | 2294 | return NULL; |
---|
| 2295 | } |
---|
| 2296 | |
---|
| 2297 | |
---|
[cf83b7a] | 2298 | void owl_command_pop_message(void) |
---|
| 2299 | { |
---|
[7d4fbcd] | 2300 | owl_function_curmsg_to_popwin(); |
---|
| 2301 | } |
---|
| 2302 | |
---|
[e19eb97] | 2303 | char *owl_command_delete(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2304 | { |
---|
[b950088] | 2305 | int move_after = 1; |
---|
| 2306 | |
---|
[8ee73f8d] | 2307 | if (argc>1 && !strcmp(argv[1], "--no-move")) { |
---|
[b950088] | 2308 | move_after = 0; |
---|
| 2309 | argc--; |
---|
| 2310 | argv++; |
---|
| 2311 | } |
---|
| 2312 | |
---|
[7d4fbcd] | 2313 | if (argc==1) { |
---|
[b950088] | 2314 | owl_function_deletecur(move_after); |
---|
[7d4fbcd] | 2315 | return NULL; |
---|
| 2316 | } |
---|
| 2317 | |
---|
| 2318 | if (argc==2 && !strcmp(argv[1], "view")) { |
---|
| 2319 | owl_function_delete_curview_msgs(1); |
---|
| 2320 | return NULL; |
---|
| 2321 | } |
---|
| 2322 | |
---|
| 2323 | if (argc==2 && !strcmp(argv[1], "trash")) { |
---|
| 2324 | owl_function_delete_automsgs(); |
---|
| 2325 | return NULL; |
---|
| 2326 | } |
---|
| 2327 | |
---|
[7360fab] | 2328 | if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { |
---|
[7d4fbcd] | 2329 | owl_function_delete_by_id(atoi(argv[2]), 1); |
---|
| 2330 | return NULL; |
---|
| 2331 | } |
---|
| 2332 | |
---|
| 2333 | owl_function_makemsg("Unknown arguments to delete command"); |
---|
| 2334 | return NULL; |
---|
| 2335 | } |
---|
| 2336 | |
---|
[e19eb97] | 2337 | char *owl_command_undelete(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2338 | { |
---|
[b950088] | 2339 | int move_after = 1; |
---|
| 2340 | |
---|
[8ee73f8d] | 2341 | if (argc>1 && !strcmp(argv[1], "--no-move")) { |
---|
[b950088] | 2342 | move_after = 0; |
---|
| 2343 | argc--; |
---|
| 2344 | argv++; |
---|
| 2345 | } |
---|
| 2346 | |
---|
[7d4fbcd] | 2347 | if (argc==1) { |
---|
[b950088] | 2348 | owl_function_undeletecur(move_after); |
---|
[7d4fbcd] | 2349 | return NULL; |
---|
| 2350 | } |
---|
| 2351 | |
---|
| 2352 | if (argc==2 && !strcmp(argv[1], "view")) { |
---|
| 2353 | owl_function_delete_curview_msgs(0); |
---|
| 2354 | return NULL; |
---|
| 2355 | } |
---|
| 2356 | |
---|
[7360fab] | 2357 | if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { |
---|
[7d4fbcd] | 2358 | owl_function_delete_by_id(atoi(argv[2]), 0); |
---|
| 2359 | return NULL; |
---|
| 2360 | } |
---|
| 2361 | |
---|
| 2362 | owl_function_makemsg("Unknown arguments to delete command"); |
---|
| 2363 | return NULL; |
---|
| 2364 | } |
---|
| 2365 | |
---|
[c79a047] | 2366 | void owl_command_beep(void) |
---|
[cf83b7a] | 2367 | { |
---|
[7d4fbcd] | 2368 | owl_function_beep(); |
---|
| 2369 | } |
---|
| 2370 | |
---|
[e19eb97] | 2371 | char *owl_command_colorview(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2372 | { |
---|
[8fa9562] | 2373 | if (argc < 2 || argc > 3) { |
---|
[7d4fbcd] | 2374 | owl_function_makemsg("Wrong number of arguments to colorview command"); |
---|
| 2375 | return NULL; |
---|
| 2376 | } |
---|
[8fa9562] | 2377 | owl_function_color_current_filter(argv[1], (argc == 3 ? argv[2] : NULL)); |
---|
[7d4fbcd] | 2378 | return NULL; |
---|
| 2379 | } |
---|
| 2380 | |
---|
[e19eb97] | 2381 | char *owl_command_colorclass(int argc, const char *const *argv, const char *buff) |
---|
[5e0b690] | 2382 | { |
---|
[e19eb97] | 2383 | const char *filtname; |
---|
[5e0b690] | 2384 | |
---|
[8fa9562] | 2385 | if (argc < 3 || argc > 4) { |
---|
[5e0b690] | 2386 | owl_function_makemsg("Wrong number of arguments to colorclass command"); |
---|
| 2387 | return NULL; |
---|
| 2388 | } |
---|
| 2389 | |
---|
[66e409c] | 2390 | filtname=owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g)); |
---|
[8fa9562] | 2391 | (void) owl_function_color_filter(filtname, argv[2], (argc == 4 ? argv[3] : NULL)); |
---|
[5e0b690] | 2392 | return NULL; |
---|
| 2393 | } |
---|
| 2394 | |
---|
[e19eb97] | 2395 | char *owl_command_zpunt(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2396 | { |
---|
[7d4fbcd] | 2397 | owl_command_zpunt_and_zunpunt(argc, argv, 0); |
---|
| 2398 | return NULL; |
---|
| 2399 | } |
---|
| 2400 | |
---|
[e19eb97] | 2401 | char *owl_command_zunpunt(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2402 | { |
---|
[7d4fbcd] | 2403 | owl_command_zpunt_and_zunpunt(argc, argv, 1); |
---|
| 2404 | return NULL; |
---|
| 2405 | } |
---|
| 2406 | |
---|
[e19eb97] | 2407 | void owl_command_zpunt_and_zunpunt(int argc, const char *const *argv, int type) |
---|
[cf83b7a] | 2408 | { |
---|
[7d4fbcd] | 2409 | /* if type==0 then zpunt |
---|
| 2410 | * if type==1 then zunpunt |
---|
| 2411 | */ |
---|
[e19eb97] | 2412 | const char *class, *inst, *recip; |
---|
[7d4fbcd] | 2413 | |
---|
| 2414 | class="message"; |
---|
| 2415 | inst=""; |
---|
| 2416 | recip="*"; |
---|
| 2417 | |
---|
| 2418 | if (argc==1) { |
---|
| 2419 | /* show current punt filters */ |
---|
| 2420 | owl_function_show_zpunts(); |
---|
| 2421 | return; |
---|
| 2422 | } else if (argc==2) { |
---|
| 2423 | inst=argv[1]; |
---|
| 2424 | } else if (argc==3) { |
---|
| 2425 | class=argv[1]; |
---|
| 2426 | inst=argv[2]; |
---|
| 2427 | } else if (argc==4) { |
---|
| 2428 | class=argv[1]; |
---|
| 2429 | inst=argv[2]; |
---|
| 2430 | recip=argv[3]; |
---|
| 2431 | } else { |
---|
| 2432 | owl_function_makemsg("Wrong number of arguments to the zpunt command"); |
---|
| 2433 | return; |
---|
| 2434 | } |
---|
| 2435 | |
---|
| 2436 | owl_function_zpunt(class, inst, recip, type); |
---|
| 2437 | if (type==0) { |
---|
| 2438 | owl_function_makemsg("<%s, %s, %s> added to punt list.", class, inst, recip); |
---|
| 2439 | } else if (type==1) { |
---|
| 2440 | owl_function_makemsg("<%s, %s, %s> removed from punt list.", class, inst, recip); |
---|
| 2441 | } |
---|
| 2442 | } |
---|
| 2443 | |
---|
[e19eb97] | 2444 | char *owl_command_smartzpunt(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2445 | { |
---|
[d36f2cb] | 2446 | if (argc == 1) { |
---|
| 2447 | owl_function_smartzpunt(0); |
---|
| 2448 | } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { |
---|
| 2449 | owl_function_smartzpunt(1); |
---|
| 2450 | } else { |
---|
| 2451 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 2452 | } |
---|
| 2453 | return NULL; |
---|
| 2454 | } |
---|
| 2455 | |
---|
[e19eb97] | 2456 | char *owl_command_punt(int argc, const char *const *argv, const char *buff) |
---|
[ce7b824] | 2457 | { |
---|
| 2458 | owl_command_punt_unpunt(argc, argv, buff, 0); |
---|
| 2459 | return NULL; |
---|
| 2460 | } |
---|
| 2461 | |
---|
[e19eb97] | 2462 | char *owl_command_unpunt(int argc, const char *const *argv, const char *buff) |
---|
[ce7b824] | 2463 | { |
---|
| 2464 | owl_command_punt_unpunt(argc, argv, buff, 1); |
---|
| 2465 | return NULL; |
---|
| 2466 | } |
---|
| 2467 | |
---|
[e19eb97] | 2468 | void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt) |
---|
[ce7b824] | 2469 | { |
---|
| 2470 | owl_list * fl; |
---|
| 2471 | owl_filter * f; |
---|
| 2472 | char * text; |
---|
| 2473 | int i; |
---|
| 2474 | |
---|
| 2475 | fl = owl_global_get_puntlist(&g); |
---|
| 2476 | if(argc == 1) { |
---|
| 2477 | owl_function_show_zpunts(); |
---|
| 2478 | } |
---|
| 2479 | |
---|
| 2480 | if(argc == 2) { |
---|
| 2481 | /* Handle :unpunt <number> */ |
---|
| 2482 | if(unpunt && (i=atoi(argv[1])) !=0) { |
---|
| 2483 | i--; /* Accept 1-based indexing */ |
---|
| 2484 | if(i < owl_list_get_size(fl)) { |
---|
[4d86e06] | 2485 | f = owl_list_get_element(fl, i); |
---|
[ce7b824] | 2486 | owl_list_remove_element(fl, i); |
---|
[23fddad] | 2487 | owl_filter_delete(f); |
---|
[ce7b824] | 2488 | return; |
---|
| 2489 | } else { |
---|
| 2490 | owl_function_error("No such filter number: %d", i+1); |
---|
| 2491 | } |
---|
| 2492 | } |
---|
| 2493 | text = owl_sprintf("filter %s", argv[1]); |
---|
[3e328b8] | 2494 | owl_function_punt(text, unpunt); |
---|
| 2495 | owl_free(text); |
---|
[ce7b824] | 2496 | } else { |
---|
[3e328b8] | 2497 | owl_function_punt(skiptokens(buff, 1), unpunt); |
---|
[ce7b824] | 2498 | } |
---|
| 2499 | } |
---|
| 2500 | |
---|
| 2501 | |
---|
[e19eb97] | 2502 | char *owl_command_getview(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2503 | { |
---|
[e19eb97] | 2504 | const char *filtname; |
---|
[8ee73f8d] | 2505 | if (argc != 1) { |
---|
| 2506 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 2507 | return NULL; |
---|
| 2508 | } |
---|
| 2509 | filtname = owl_view_get_filtname(owl_global_get_current_view(&g)); |
---|
[fa4562c] | 2510 | if (filtname) return owl_strdup(filtname); |
---|
| 2511 | return NULL; |
---|
[8ee73f8d] | 2512 | } |
---|
[d36f2cb] | 2513 | |
---|
[e19eb97] | 2514 | char *owl_command_getvar(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2515 | { |
---|
[8ee73f8d] | 2516 | char tmpbuff[1024]; |
---|
| 2517 | if (argc != 2) { |
---|
| 2518 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 2519 | return NULL; |
---|
| 2520 | } |
---|
| 2521 | if (owl_variable_get_tostring(owl_global_get_vardict(&g), |
---|
| 2522 | argv[1], tmpbuff, 1024)) { |
---|
| 2523 | return NULL; |
---|
| 2524 | } |
---|
| 2525 | return owl_strdup(tmpbuff); |
---|
| 2526 | } |
---|
[7d4fbcd] | 2527 | |
---|
[e19eb97] | 2528 | char *owl_command_getfilter(int argc, const char *const *argv, const char *buf) |
---|
[cdc6ff1] | 2529 | { |
---|
[4542047] | 2530 | const owl_filter *f; |
---|
[cdc6ff1] | 2531 | if (argc != 2) { |
---|
| 2532 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 2533 | return NULL; |
---|
| 2534 | } |
---|
| 2535 | f = owl_global_get_filter(&g, argv[1]); |
---|
| 2536 | if (!f) { |
---|
| 2537 | return NULL; |
---|
| 2538 | } |
---|
| 2539 | return owl_filter_print(f); |
---|
| 2540 | } |
---|
| 2541 | |
---|
[e19eb97] | 2542 | char *owl_command_search(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2543 | { |
---|
[1fd0b25] | 2544 | int direction; |
---|
[e19eb97] | 2545 | const char *buffstart; |
---|
[1fd0b25] | 2546 | |
---|
| 2547 | direction=OWL_DIRECTION_DOWNWARDS; |
---|
| 2548 | buffstart=skiptokens(buff, 1); |
---|
| 2549 | if (argc>1 && !strcmp(argv[1], "-r")) { |
---|
| 2550 | direction=OWL_DIRECTION_UPWARDS; |
---|
| 2551 | buffstart=skiptokens(buff, 2); |
---|
| 2552 | } |
---|
| 2553 | |
---|
| 2554 | if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) { |
---|
[118c919] | 2555 | /* When continuing a search, don't consider the current message. */ |
---|
| 2556 | owl_function_search_helper(false, direction); |
---|
[1fd0b25] | 2557 | } else { |
---|
[a728387] | 2558 | owl_function_set_search(buffstart); |
---|
[118c919] | 2559 | owl_function_search_helper(true, direction); |
---|
[1fd0b25] | 2560 | } |
---|
| 2561 | |
---|
| 2562 | return(NULL); |
---|
| 2563 | } |
---|
| 2564 | |
---|
[e19eb97] | 2565 | char *owl_command_setsearch(int argc, const char *const *argv, const char *buff) |
---|
[987ff51] | 2566 | { |
---|
[e19eb97] | 2567 | const char *buffstart; |
---|
[987ff51] | 2568 | |
---|
| 2569 | buffstart=skiptokens(buff, 1); |
---|
[2ec737f] | 2570 | owl_function_set_search(*buffstart ? buffstart : NULL); |
---|
[987ff51] | 2571 | |
---|
| 2572 | return(NULL); |
---|
| 2573 | } |
---|
| 2574 | |
---|
[e19eb97] | 2575 | char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2576 | { |
---|
[453bd70] | 2577 | if ((argc<2) || (argc>3)) { |
---|
[d09e5a1] | 2578 | owl_function_makemsg("Wrong number of arguments to aimlogin command"); |
---|
| 2579 | return(NULL); |
---|
| 2580 | } |
---|
[aa5f725] | 2581 | |
---|
[453bd70] | 2582 | /* if we get two arguments, ask for the password */ |
---|
| 2583 | if (argc==2) { |
---|
[9186c75] | 2584 | owl_editwin *e = owl_function_start_password("AIM Password: "); |
---|
| 2585 | owl_editwin_set_cbdata(e, owl_strdup(argv[1]), owl_free); |
---|
| 2586 | owl_editwin_set_callback(e, owl_callback_aimlogin); |
---|
[453bd70] | 2587 | return(NULL); |
---|
[4211f50b] | 2588 | } else { |
---|
| 2589 | owl_function_aimlogin(argv[1], argv[2]); |
---|
[453bd70] | 2590 | } |
---|
| 2591 | |
---|
[a352335c] | 2592 | /* this is a test */ |
---|
[d09e5a1] | 2593 | return(NULL); |
---|
| 2594 | } |
---|
| 2595 | |
---|
[e19eb97] | 2596 | char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2597 | { |
---|
[aa5f725] | 2598 | /* clear the buddylist */ |
---|
| 2599 | owl_buddylist_clear(owl_global_get_buddylist(&g)); |
---|
| 2600 | |
---|
[d09e5a1] | 2601 | owl_aim_logout(); |
---|
| 2602 | return(NULL); |
---|
| 2603 | } |
---|
| 2604 | |
---|
[e19eb97] | 2605 | char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) |
---|
[216c734] | 2606 | { |
---|
[e19eb97] | 2607 | const char *stylename; |
---|
[216c734] | 2608 | if (argc != 1) { |
---|
| 2609 | owl_function_makemsg("Wrong number of arguments for %s", argv[0]); |
---|
| 2610 | return NULL; |
---|
| 2611 | } |
---|
| 2612 | stylename = owl_view_get_style_name(owl_global_get_current_view(&g)); |
---|
[fa4562c] | 2613 | if (stylename) return owl_strdup(stylename); |
---|
| 2614 | return NULL; |
---|
[216c734] | 2615 | } |
---|
| 2616 | |
---|
[e19eb97] | 2617 | char *owl_command_error(int argc, const char *const *argv, const char *buff) |
---|
[4692b70] | 2618 | { |
---|
| 2619 | buff = skiptokens(buff, 1); |
---|
[554a2b8] | 2620 | owl_function_error("%s", buff); |
---|
[4692b70] | 2621 | return NULL; |
---|
| 2622 | } |
---|
| 2623 | |
---|
[e19eb97] | 2624 | char *owl_command_message(int argc, const char *const *argv, const char *buff) |
---|
[4692b70] | 2625 | { |
---|
| 2626 | buff = skiptokens(buff, 1); |
---|
[554a2b8] | 2627 | owl_function_makemsg("%s", buff); |
---|
[4692b70] | 2628 | return NULL; |
---|
| 2629 | } |
---|
| 2630 | |
---|
[12e5f17] | 2631 | void owl_command_yes(void) |
---|
[f4d32cd] | 2632 | { |
---|
[cba04e0] | 2633 | owl_message *m; |
---|
[9e5c9f3] | 2634 | const owl_view *v; |
---|
[e19eb97] | 2635 | const char *cmd; |
---|
[cba04e0] | 2636 | |
---|
| 2637 | v = owl_global_get_current_view(&g); |
---|
| 2638 | |
---|
| 2639 | /* bail if there's no current message */ |
---|
| 2640 | if (owl_view_get_size(v) < 1) { |
---|
| 2641 | owl_function_error("No current message."); |
---|
[12e5f17] | 2642 | return; |
---|
[cba04e0] | 2643 | } |
---|
| 2644 | |
---|
| 2645 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
[f4d32cd] | 2646 | if(!owl_message_is_question(m)) { |
---|
| 2647 | owl_function_error("That message isn't a question."); |
---|
[12e5f17] | 2648 | return; |
---|
[f4d32cd] | 2649 | } |
---|
| 2650 | if(owl_message_is_answered(m)) { |
---|
| 2651 | owl_function_error("You already answered that question."); |
---|
[12e5f17] | 2652 | return; |
---|
[f4d32cd] | 2653 | } |
---|
[ad15610] | 2654 | cmd = owl_message_get_attribute_value(m, "yescommand"); |
---|
[f4d32cd] | 2655 | if(!cmd) { |
---|
[451db9e] | 2656 | owl_function_error("No 'yes' command!"); |
---|
[12e5f17] | 2657 | return; |
---|
[f4d32cd] | 2658 | } |
---|
| 2659 | |
---|
| 2660 | owl_function_command_norv(cmd); |
---|
| 2661 | owl_message_set_isanswered(m); |
---|
[12e5f17] | 2662 | return; |
---|
[f4d32cd] | 2663 | } |
---|
| 2664 | |
---|
[12e5f17] | 2665 | void owl_command_no(void) |
---|
[f4d32cd] | 2666 | { |
---|
[cba04e0] | 2667 | owl_message *m; |
---|
[9e5c9f3] | 2668 | const owl_view *v; |
---|
[e19eb97] | 2669 | const char *cmd; |
---|
[cba04e0] | 2670 | |
---|
| 2671 | v = owl_global_get_current_view(&g); |
---|
| 2672 | |
---|
| 2673 | /* bail if there's no current message */ |
---|
| 2674 | if (owl_view_get_size(v) < 1) { |
---|
| 2675 | owl_function_error("No current message."); |
---|
[12e5f17] | 2676 | return; |
---|
[cba04e0] | 2677 | } |
---|
| 2678 | |
---|
| 2679 | m = owl_view_get_element(v, owl_global_get_curmsg(&g)); |
---|
[f4d32cd] | 2680 | if(!owl_message_is_question(m)) { |
---|
| 2681 | owl_function_error("That message isn't a question."); |
---|
[12e5f17] | 2682 | return; |
---|
[f4d32cd] | 2683 | } |
---|
| 2684 | if(owl_message_is_answered(m)) { |
---|
| 2685 | owl_function_error("You already answered that question."); |
---|
[12e5f17] | 2686 | return; |
---|
[f4d32cd] | 2687 | } |
---|
[ad15610] | 2688 | cmd = owl_message_get_attribute_value(m, "nocommand"); |
---|
[f4d32cd] | 2689 | if(!cmd) { |
---|
[451db9e] | 2690 | owl_function_error("No 'no' command!"); |
---|
[12e5f17] | 2691 | return; |
---|
[f4d32cd] | 2692 | } |
---|
| 2693 | |
---|
| 2694 | owl_function_command_norv(cmd); |
---|
| 2695 | owl_message_set_isanswered(m); |
---|
[12e5f17] | 2696 | return; |
---|
[f4d32cd] | 2697 | } |
---|
| 2698 | |
---|
[7d4fbcd] | 2699 | /*********************************************************************/ |
---|
| 2700 | /************************** EDIT SPECIFIC ****************************/ |
---|
| 2701 | /*********************************************************************/ |
---|
| 2702 | |
---|
[cf83b7a] | 2703 | void owl_command_edit_cancel(owl_editwin *e) |
---|
| 2704 | { |
---|
[10b866d] | 2705 | owl_history *hist; |
---|
| 2706 | |
---|
[7d4fbcd] | 2707 | owl_function_makemsg("Command cancelled."); |
---|
[10b866d] | 2708 | |
---|
[a556caa] | 2709 | if(owl_editwin_get_echochar(e) == 0) { |
---|
[6e400cc] | 2710 | hist=owl_editwin_get_history(e); |
---|
| 2711 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
| 2712 | owl_history_reset(hist); |
---|
| 2713 | } |
---|
[10b866d] | 2714 | |
---|
[2a17b63] | 2715 | owl_global_pop_context(&g); |
---|
[7d4fbcd] | 2716 | } |
---|
| 2717 | |
---|
[cf83b7a] | 2718 | void owl_command_edit_history_prev(owl_editwin *e) |
---|
| 2719 | { |
---|
[7d4fbcd] | 2720 | owl_history *hist; |
---|
[e19eb97] | 2721 | const char *ptr; |
---|
[7d4fbcd] | 2722 | |
---|
[10b866d] | 2723 | hist=owl_editwin_get_history(e); |
---|
[7d4fbcd] | 2724 | if (!owl_history_is_touched(hist)) { |
---|
| 2725 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
| 2726 | owl_history_set_partial(hist); |
---|
| 2727 | } |
---|
| 2728 | ptr=owl_history_get_prev(hist); |
---|
| 2729 | if (ptr) { |
---|
| 2730 | owl_editwin_clear(e); |
---|
| 2731 | owl_editwin_insert_string(e, ptr); |
---|
| 2732 | } else { |
---|
| 2733 | owl_function_beep(); |
---|
| 2734 | } |
---|
| 2735 | } |
---|
| 2736 | |
---|
[cf83b7a] | 2737 | void owl_command_edit_history_next(owl_editwin *e) |
---|
| 2738 | { |
---|
[7d4fbcd] | 2739 | owl_history *hist; |
---|
[e19eb97] | 2740 | const char *ptr; |
---|
[7d4fbcd] | 2741 | |
---|
[10b866d] | 2742 | hist=owl_editwin_get_history(e); |
---|
[7d4fbcd] | 2743 | ptr=owl_history_get_next(hist); |
---|
| 2744 | if (ptr) { |
---|
| 2745 | owl_editwin_clear(e); |
---|
| 2746 | owl_editwin_insert_string(e, ptr); |
---|
| 2747 | } else { |
---|
| 2748 | owl_function_beep(); |
---|
| 2749 | } |
---|
| 2750 | } |
---|
| 2751 | |
---|
[e19eb97] | 2752 | char *owl_command_edit_insert_text(owl_editwin *e, int argc, const char *const *argv, const char *buff) |
---|
[cf83b7a] | 2753 | { |
---|
[7d4fbcd] | 2754 | buff = skiptokens(buff, 1); |
---|
| 2755 | owl_editwin_insert_string(e, buff); |
---|
| 2756 | return NULL; |
---|
| 2757 | } |
---|
| 2758 | |
---|
[435d6b2] | 2759 | void owl_command_edit_done(owl_editwin *e) |
---|
[cf83b7a] | 2760 | { |
---|
[10b866d] | 2761 | owl_history *hist=owl_editwin_get_history(e); |
---|
| 2762 | |
---|
[0d17295] | 2763 | if (hist) { |
---|
| 2764 | owl_history_store(hist, owl_editwin_get_text(e)); |
---|
| 2765 | owl_history_reset(hist); |
---|
| 2766 | } |
---|
[10b866d] | 2767 | |
---|
[c394de8] | 2768 | /* Take a reference to the editwin, so that it survives the pop |
---|
| 2769 | * context. TODO: We should perhaps refcount or otherwise protect |
---|
| 2770 | * the context so that, even if a command pops a context, the |
---|
| 2771 | * context itself will last until the command returns. */ |
---|
| 2772 | owl_editwin_ref(e); |
---|
[2a17b63] | 2773 | owl_global_pop_context(&g); |
---|
[d83621c4] | 2774 | |
---|
| 2775 | owl_editwin_do_callback(e); |
---|
[9190285] | 2776 | owl_editwin_unref(e); |
---|
[7d4fbcd] | 2777 | } |
---|
| 2778 | |
---|
[435d6b2] | 2779 | void owl_command_edit_done_or_delete(owl_editwin *e) |
---|
[cf83b7a] | 2780 | { |
---|
[217a43e] | 2781 | if (owl_editwin_is_at_end(e)) { |
---|
[435d6b2] | 2782 | owl_command_edit_done(e); |
---|
[217a43e] | 2783 | } else { |
---|
| 2784 | owl_editwin_delete_char(e); |
---|
| 2785 | } |
---|
| 2786 | } |
---|
| 2787 | |
---|
[7d4fbcd] | 2788 | |
---|
| 2789 | /*********************************************************************/ |
---|
| 2790 | /*********************** POPLESS SPECIFIC ****************************/ |
---|
| 2791 | /*********************************************************************/ |
---|
| 2792 | |
---|
[cf83b7a] | 2793 | void owl_command_popless_quit(owl_viewwin *vw) |
---|
| 2794 | { |
---|
[8ee712e0] | 2795 | owl_popwin *pw; |
---|
| 2796 | pw = owl_global_get_popwin(&g); |
---|
| 2797 | owl_global_set_popwin(&g, NULL); |
---|
[9eb38bb] | 2798 | /* Kind of a hack, but you can only have one active viewwin right |
---|
| 2799 | * now anyway. */ |
---|
| 2800 | if (vw == owl_global_get_viewwin(&g)) |
---|
| 2801 | owl_global_set_viewwin(&g, NULL); |
---|
| 2802 | owl_viewwin_delete(vw); |
---|
[8ee712e0] | 2803 | owl_popwin_delete(pw); |
---|
[2a17b63] | 2804 | owl_global_pop_context(&g); |
---|
[7d4fbcd] | 2805 | } |
---|