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