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