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