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