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