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