forked from barnowl/barnowl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.c
2896 lines (2476 loc) · 86.7 KB
/
commands.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "owl.h"
#include <getopt.h>
/* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */
#define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, fn, NULL, NULL, NULL, NULL, NULL, NULL }
/* fn is "void foo(void)" */
#define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, NULL, fn, NULL, NULL, NULL, NULL, NULL }
/* fn is "void foo(int)" */
#define OWLCMD_INT(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, NULL, NULL, fn, NULL, NULL, NULL, NULL }
#define OWLCMD_ALIAS(name, actualname) \
{ g_strdup(name), g_strdup(OWL_CMD_ALIAS_SUMMARY_PREFIX actualname), g_strdup(""), g_strdup(""), OWL_CTX_ANY, \
g_strdup(actualname), NULL, NULL, NULL, NULL, NULL, NULL, NULL }
/* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */
#define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL }
/* fn is "void foo(void)" */
#define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL, NULL }
/* fn is "void foo(int)" */
#define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \
{ g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn), NULL }
void owl_cmd_add_defaults(owl_cmddict *cd)
{
owl_cmd commands_to_init[] = {
OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
"send a login or logout notification",
"zlog in [tty]\nzlog out",
"zlog in will send a login notification, zlog out will send a\n"
"logout notification. By default a login notification is sent\n"
"when BarnOwl is started and a logout notification is sent when owl\n"
"is exited. This behavior can be changed with the 'startuplogin'\n"
"and 'shutdownlogout' variables. If a tty is specified for zlog in\n"
"then the BarnOwl variable 'tty' will be set to that string, causing\n"
"it to be used as the zephyr location tty.\n"),
OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY,
"exit BarnOwl",
"",
"Exit BarnOwl and run any shutdown activities."),
OWLCMD_ALIAS("exit", "quit"),
OWLCMD_ALIAS("q", "quit"),
OWLCMD_ARGS("term", owl_command_term, OWL_CTX_ANY,
"control the terminal",
"term raise\n"
"term deiconify\n",
""),
OWLCMD_VOID("nop", owl_command_nop, OWL_CTX_ANY,
"do nothing",
"",
""),
OWLCMD_ARGS("start-command", owl_command_start_command, OWL_CTX_INTERACTIVE,
"prompts the user to enter a command",
"start-command [initial-value]",
"Initializes the command field to initial-value."),
OWLCMD_ARGS("alias", owl_command_alias, OWL_CTX_ANY,
"creates a command alias",
"alias <new_command> <old_command>",
"Creates a command alias from new_command to old_command.\n"
"Any arguments passed to <new_command> will be appended to\n"
"<old_command> before it is executed.\n"),
OWLCMD_ARGS("bindkey", owl_command_bindkey, OWL_CTX_ANY,
"creates a binding in a keymap",
"bindkey <keymap> <keyseq> command <command>",
"(Note: There is a literal word \"command\" between <keyseq>\n"
" and <command>.)\n"
"Binds a key sequence to a command within a keymap.\n"
"Use 'show keymaps' to see the existing keymaps.\n"
"Key sequences may be things like M-C-t or NPAGE.\n\n"
"Ex.: bindkey recv C-b command zwrite -c barnowl\n"
"Ex.: bindkey recv m command start-command zwrite -c my-class -i \n\n"
"SEE ALSO: unbindkey, start-command"),
OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY,
"removes a binding in a keymap",
"unbindkey <keymap> <keyseq>",
"Removes a binding of a key sequence within a keymap.\n"
"Use 'show keymaps' to see the existing keymaps.\n"
"Ex.: unbindkey recv H\n\n"
"SEE ALSO: bindkey"),
OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
"send a zephyr",
"zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [<user> ...] [-m <message...>]",
"Zwrite send a zephyr to the one or more users specified.\n\n"
"The following options are available:\n\n"
"-m Specifies a message to send without prompting.\n"
" Note that this does not yet log an outgoing message.\n"
" This must be the last argument.\n\n"
"-n Do not send a ping message.\n\n"
"-C If the message is sent to more than one user include a\n"
" \"cc:\" line in the text\n\n"
"-c class\n"
" Send to the specified zephyr class\n\n"
"-i instance\n"
" Send to the specified zephyr instance\n\n"
"-r realm\n"
" Send to a foreign realm\n"
"-O opcode\n"
" Send to the specified opcode\n"),
OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
"send an AIM message",
"aimwrite <user> [-m <message...>]",
"Send an aim message to a user.\n\n"
"The following options are available:\n\n"
"-m Specifies a message to send without prompting.\n"),
OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
"send a loopback message",
"loopwrite",
"Send a local message.\n"),
OWLCMD_ARGS("zcrypt", owl_command_zwrite, OWL_CTX_INTERACTIVE,
"send an encrypted zephyr",
"zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n",
"Behaves like zwrite but uses encryption. Not for use with\n"
"personal messages\n"),
OWLCMD_ARGS("reply", owl_command_reply, OWL_CTX_INTERACTIVE,
"reply to the current message",
"reply [-e] [ sender | all | zaway ]",
"If -e is specified, the zwrite command line is presented to\n"
"allow editing.\n\n"
"If 'sender' is specified, reply to the sender.\n\n"
"If 'all' or no args are specified, reply publicly to the\n"
"same class/instance for non-personal messages and to the\n"
"sender for personal messages.\n\n"
"If 'zaway' is specified, replies with a zaway message.\n\n"),
OWLCMD_ARGS("set", owl_command_set, OWL_CTX_ANY,
"set a variable value",
"set [-q] [<variable>] [<value>]\n"
"set",
"Set the named variable to the specified value. If no\n"
"arguments are given, print the value of all variables.\n"
"If the value is unspecified and the variable is a boolean, it will be\n"
"set to 'on'. If -q is used, set is silent and does not print a\n"
"message.\n"),
OWLCMD_ARGS("unset", owl_command_unset, OWL_CTX_ANY,
"unset a boolean variable value",
"unset [-q] <variable>\n"
"unset",
"Set the named boolean variable to off.\n"
"If -q is specified, is silent and doesn't print a message.\n"),
OWLCMD_ARGS("print", owl_command_print, OWL_CTX_ANY,
"print a variable value",
"print <variable>\n"
"print",
"Print the value of the named variable. If no arguments\n"
"are used print the value of all variables.\n"),
OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY,
"run a command and set it to be run at every BarnOwl startup",
"startup <commands> ...",
"Everything on the command line after the startup command\n"
"is executed as a normal BarnOwl command and is also placed in\n"
"a file so that the command is executed every time BarnOwl\n"
"is started"),
OWLCMD_ARGS("unstartup", owl_command_unstartup, OWL_CTX_ANY,
"remove a command from the list of those to be run at BarnOwl startup",
"unstartup <commands> ...",
""),
OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY,
"print the version of the running BarnOwl", "", ""),
OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY,
"subscribe to a zephyr class, instance, recipient",
"subscribe [-t] <class> [instance [recipient]]",
"Subscribe to the specified class and instance. If the\n"
"instance or recipient is not listed on the command\n"
"line they default to * (the wildcard recipient).\n"
"If the -t option is present the subscription will\n"
"only be temporary, i.e., it will not be written to\n"
"the subscription file and will therefore not be\n"
"present the next time BarnOwl is started.\n"),
OWLCMD_ALIAS("sub", "subscribe"),
OWLCMD_ARGS("unsubscribe", owl_command_unsubscribe, OWL_CTX_ANY,
"unsubscribe from a zephyr class, instance, recipient",
"unsubscribe [-t] <class> [instance [recipient]]",
"Unsubscribe from the specified class and instance. If the\n"
"instance or recipient is not listed on the command\n"
"line they default to * (the wildcard recipient).\n"
"If the -t option is present the unsubscription will\n"
"only be temporary, i.e., it will not be updated in\n"
"the subscription file and will therefore not be\n"
"in effect the next time BarnOwl is started.\n"),
OWLCMD_ALIAS("unsub", "unsubscribe"),
OWLCMD_VOID("unsuball", owl_command_unsuball, OWL_CTX_ANY,
"unsubscribe from all zephyrs", "", ""),
OWLCMD_VOID("getsubs", owl_command_getsubs, OWL_CTX_ANY,
"print all current subscriptions",
"getsubs",
"getsubs retrieves the current subscriptions from the server\n"
"and displays them.\n"),
OWLCMD_ARGS("dump", owl_command_dump, OWL_CTX_ANY,
"dump messages to a file",
"dump <filename>",
"Dump messages in current view to the named file."),
OWLCMD_ARGS("source", owl_command_source, OWL_CTX_ANY,
"execute BarnOwl commands from a file",
"source <filename>",
"Execute the BarnOwl commands in <filename>.\n"),
OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE,
"AIM specific commands",
"aim search <email>",
""),
OWLCMD_ARGS("addbuddy", owl_command_addbuddy, OWL_CTX_INTERACTIVE,
"add a buddy to a buddylist",
"addbuddy <protocol> <screenname>",
"Add the named buddy to your buddylist. <protocol> can be aim or zephyr\n"),
OWLCMD_ARGS("delbuddy", owl_command_delbuddy, OWL_CTX_INTERACTIVE,
"delete a buddy from a buddylist",
"delbuddy <protocol> <screenname>",
"Delete the named buddy from your buddylist. <protocol> can be aim or zephyr\n"),
OWLCMD_ARGS("join", owl_command_join, OWL_CTX_INTERACTIVE,
"join a chat group",
"join aim <groupname> [exchange]",
"Join the AIM chatroom with 'groupname'.\n"),
OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE,
"creates a zpunt based on the current message",
"smartzpunt [-i | --instance]",
"Starts a zpunt command based on the current message's class\n"
"(and instance if -i is specified).\n"),
OWLCMD_ARGS("zpunt", owl_command_zpunt, OWL_CTX_ANY,
"suppress a given zephyr triplet",
"zpunt <class> <instance> [recipient]\n"
"zpunt <instance>",
"The zpunt command will suppress messages to the specified\n"
"zephyr triplet. In the second usage messages are suppressed\n"
"for class MESSAGE and the named instance.\n\n"
"SEE ALSO: zunpunt, show zpunts\n"),
OWLCMD_ARGS("zunpunt", owl_command_zunpunt, OWL_CTX_ANY,
"undo a previous zpunt",
"zunpunt <class> <instance> [recipient]\n"
"zunpunt <instance>",
"The zunpunt command will allow messages that were previously\n"
"suppressed to be received again.\n\n"
"SEE ALSO: zpunt, show zpunts\n"),
OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY,
"suppress an arbitrary filter",
"punt <filter-name>\n"
"punt <filter-text (multiple words)>",
"The punt command will suppress messages to the specified\n"
"filter\n\n"
"SEE ALSO: unpunt, zpunt, show zpunts\n"),
OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY,
"remove an entry from the punt list",
"unpunt <number>\n"
"unpunt <filter-name>\n"
"unpunt <filter-text (multiple words)>",
"The unpunt command will remove an entry from the puntlist.\n"
"The last two forms correspond to the two forms of the :punt\n"
"command. The first allows you to remove a specific entry from\n"
"the list (see :show zpunts)\n\n"
"SEE ALSO: punt, zpunt, zunpunt, show zpunts\n"),
OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
"display detailed information about the current message",
"", ""),
OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE,
"display help on using BarnOwl",
"help [command]", ""),
OWLCMD_ARGS("zlist", owl_command_zlist, OWL_CTX_INTERACTIVE,
"List users logged in",
"znol [-f file]",
"Print a znol-style listing of users logged in"),
OWLCMD_VOID("alist", owl_command_alist, OWL_CTX_INTERACTIVE,
"List AIM users logged in",
"alist",
"Print a listing of AIM users logged in"),
OWLCMD_VOID("blist", owl_command_blist, OWL_CTX_INTERACTIVE,
"List all buddies logged in",
"blist",
"Print a listing of buddies logged in, regardless of protocol."),
OWLCMD_VOID("toggle-oneline", owl_command_toggleoneline, OWL_CTX_INTERACTIVE,
"Toggle the style between oneline and the default style",
"toggle-oneline",
""),
OWLCMD_ARGS("recv:getshift", owl_command_get_shift, OWL_CTX_INTERACTIVE,
"gets position of receive window scrolling", "", ""),
OWLCMD_INT("recv:setshift", owl_command_set_shift, OWL_CTX_INTERACTIVE,
"scrolls receive window to specified position", "", ""),
OWLCMD_VOID("recv:pagedown", owl_function_mainwin_pagedown,
OWL_CTX_INTERACTIVE,
"scrolls down by a page", "", ""),
OWLCMD_VOID("recv:pageup", owl_function_mainwin_pageup, OWL_CTX_INTERACTIVE,
"scrolls up by a page", "", ""),
OWLCMD_VOID("recv:mark", owl_function_mark_message,
OWL_CTX_INTERACTIVE,
"mark the current message", "", ""),
OWLCMD_VOID("recv:swapmark", owl_function_swap_cur_marked,
OWL_CTX_INTERACTIVE,
"swap the positions of the pointer and the mark", "", ""),
OWLCMD_INT ("recv:scroll", owl_function_page_curmsg, OWL_CTX_INTERACTIVE,
"scrolls current message up or down",
"recv:scroll <numlines>",
"Scrolls the current message up or down by <numlines>.\n"
"Scrolls up if <numlines> is negative, else scrolls down.\n"),
OWLCMD_ARGS("next", owl_command_next, OWL_CTX_INTERACTIVE,
"move the pointer to the next message",
"recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]\n"
" [ --smart-filter | --smart-filter-instance ]",
"Moves the pointer to the next message in the current view.\n"
"If --filter is specified, will only consider messages in\n"
"the filter <name>.\n"
"If --smart-filter or --smart-filter-instance is specified,\n"
"goes to the next message that is similar to the current message.\n"
"If --skip-deleted is specified, deleted messages will\n"
"be skipped.\n"
"If --last-if-none is specified, will stop at last message\n"
"in the view if no other suitable messages are found.\n"),
OWLCMD_ALIAS("recv:next", "next"),
OWLCMD_ARGS("prev", owl_command_prev, OWL_CTX_INTERACTIVE,
"move the pointer to the previous message",
"recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]\n"
" [ --smart-filter | --smart-filter-instance ]",
"Moves the pointer to the next message in the current view.\n"
"If --filter is specified, will only consider messages in\n"
"the filter <name>.\n"
"If --smart-filter or --smart-filter-instance is specified,\n"
"goes to the previous message that is similar to the current message.\n"
"If --skip-deleted is specified, deleted messages will\n"
"be skipped.\n"
"If --first-if-none is specified, will stop at first message\n"
"in the view if no other suitable messages are found.\n"),
OWLCMD_ALIAS("recv:prev", "prev"),
OWLCMD_ALIAS("recv:next-notdel", "recv:next --skip-deleted --last-if-none"),
OWLCMD_ALIAS("next-notdel", "recv:next --skip-deleted --last-if-none"),
OWLCMD_ALIAS("recv:prev-notdel", "recv:prev --skip-deleted --first-if-none"),
OWLCMD_ALIAS("prev-notdel", "recv:prev --skip-deleted --first-if-none"),
OWLCMD_ALIAS("recv:next-personal", "recv:next --filter personal"),
OWLCMD_ALIAS("recv:prev-personal", "recv:prev --filter personal"),
OWLCMD_VOID("first", owl_command_first, OWL_CTX_INTERACTIVE,
"move the pointer to the first message", "", ""),
OWLCMD_ALIAS("recv:first", "first"),
OWLCMD_VOID("last", owl_command_last, OWL_CTX_INTERACTIVE,
"move the pointer to the last message", "",
"Moves the pointer to the last message in the view.\n"
"If we are already at the last message in the view,\n"
"blanks the screen and moves just past the end of the view\n"
"so that new messages will appear starting at the top\n"
"of the screen.\n"),
OWLCMD_ALIAS("recv:last", "last"),
OWLCMD_VOID("expunge", owl_command_expunge, OWL_CTX_INTERACTIVE,
"remove all messages marked for deletion", "", ""),
OWLCMD_VOID("resize", owl_command_resize, OWL_CTX_ANY,
"resize the window to the current screen size", "", ""),
OWLCMD_VOID("redisplay", owl_command_redisplay, OWL_CTX_ANY,
"redraw the entire window", "", ""),
OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY,
"suspend BarnOwl", "", ""),
OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY,
"pops up a message in popup window",
"echo [args .. ]\n\n", ""),
OWLCMD_ARGS("exec", owl_command_exec, OWL_CTX_ANY,
"run a command from the shell",
"exec [args .. ]", ""),
OWLCMD_ARGS("aexec", owl_command_aexec, OWL_CTX_INTERACTIVE,
"run a command from the shell and display in an admin message",
"aexec [args .. ]", ""),
OWLCMD_ARGS("pexec", owl_command_pexec, OWL_CTX_INTERACTIVE,
"run a command from the shell and display in a popup window",
"pexec [args .. ]", ""),
OWLCMD_ARGS("perl", owl_command_perl, OWL_CTX_ANY,
"run a perl expression",
"perl [args .. ]", ""),
OWLCMD_ARGS("aperl", owl_command_aperl, OWL_CTX_INTERACTIVE,
"run a perl expression and display in an admin message",
"aperl [args .. ]", ""),
OWLCMD_ARGS("pperl", owl_command_pperl, OWL_CTX_INTERACTIVE,
"run a perl expression and display in a popup window",
"pperl [args .. ]", ""),
OWLCMD_ARGS("multi", owl_command_multi, OWL_CTX_ANY,
"runs multiple ;-separated commands",
"multi <command1> ( ; <command2> )*\n",
"Runs multiple semicolon-separated commands in order.\n"
"Note quoting isn't supported here yet.\n"
"If you want to do something fancy, use perl.\n"),
OWLCMD_ARGS("(", owl_command_multi, OWL_CTX_ANY,
"runs multiple ;-separated commands",
"'(' <command1> ( ; <command2> )* ')'\n",
"Runs multiple semicolon-separated commands in order.\n"
"You must have a space before the final ')'\n"
"Note quoting isn't supported here yet.\n"
"If you want to do something fancy, use perl.\n"),
OWLCMD_VOID("pop-message", owl_command_pop_message, OWL_CTX_RECWIN,
"pops up a message in a window", "", ""),
OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE,
"Set, enable or disable zephyr away message",
"zaway [ on | off | toggle ]\n"
"zaway <message>",
"Turn on or off a zaway message. If 'message' is\n"
"specified turn on zaway with that message, otherwise\n"
"use the default.\n"),
OWLCMD_ARGS("aaway", owl_command_aaway, OWL_CTX_INTERACTIVE,
"Set, enable or disable AIM away message",
"aaway [ on | off | toggle ]\n"
"aaway <message>",
"Turn on or off the AIM away message. If 'message' is\n"
"specified turn on aaway with that message, otherwise\n"
"use the default.\n"),
OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE,
"Set, enable or disable both AIM and zephyr away messages",
"away [ on | off | toggle ]\n"
"away <message>",
"Turn on or off the AIM and zephyr away message. If\n"
"'message' is specified turn them on with that message,\n"
"otherwise use the default.\n"
"\n"
"This command really just runs the 'aaway' and 'zaway'\n"
"commands together\n"
"\n"
"SEE ALSO: aaway, zaway"),
OWLCMD_ARGS("load-subs", owl_command_loadsubs, OWL_CTX_ANY,
"load subscriptions from a file",
"load-subs <file>\n", ""),
OWLCMD_ARGS("loadsubs", owl_command_loadsubs, OWL_CTX_ANY,
"load subscriptions from a file",
"loadsubs <file>\n", ""),
OWLCMD_ARGS("loadloginsubs", owl_command_loadloginsubs, OWL_CTX_ANY,
"load login subscriptions from a file",
"loadloginsubs <file>\n",
"The file should contain a list of usernames, one per line."),
OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE,
"print information about BarnOwl", "", ""),
OWLCMD_VOID("status", owl_command_status, OWL_CTX_ANY,
"print status information about the running BarnOwl", "", ""),
OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE,
"locate a user",
"zlocate [-d] <user> ...",
"Performs a zlocate on one ore more users and puts the result\n"
"int a popwin. If -d is specified, does not authenticate\n"
"the lookup request.\n"),
OWLCMD_ARGS("filter", owl_command_filter, OWL_CTX_ANY,
"create a message filter",
"filter <name> [ -c fgcolor ] [ -b bgcolor ] [ <expression> ... ]",
"The filter command creates a filter with the specified name,\n"
"or if one already exists it is replaced. Example filter\n"
"syntax would be:\n\n"
" filter myfilter -c red ( class ^foobar$ ) or ( class ^quux$ and instance ^bar$ )\n\n"
"Valid matching fields are:\n"
" sender - sender\n"
" recipient - recipient\n"
" class - zephyr class name\n"
" instance - zephyr instance name\n"
" opcode - zephyr opcode\n"
" realm - zephyr realm\n"
" body - message body\n"
" hostname - hostname of sending host\n"
" type - message type (zephyr, aim, admin)\n"
" direction - either 'in' 'out' or 'none'\n"
" login - either 'login' 'logout' or 'none'\n"
"Also you may match on the validity of another filter:\n"
" filter <filtername>\n"
"Also you may pass the message to a perl function returning 0 or 1,\n"
"where 1 indicates that the function matches the filter:\n"
" perl <subname>\n"
"Valid operators are:\n"
" and\n"
" or\n"
" not\n"
"And additionally you may use the static values:\n"
" true\n"
" false\n"
"Spaces must be present before and after parentheses. If the\n"
"optional color arguments are used they specifies the colors that\n"
"messages matching this filter should be displayed in.\n\n"
"SEE ALSO: view, viewclass, viewuser\n"),
OWLCMD_ARGS("colorview", owl_command_colorview, OWL_CTX_INTERACTIVE,
"change the colors on the current filter",
"colorview <fgcolor> [<bgcolor>]",
"The colors of messages in the current filter will be changed\n"
"to <fgcolor>,<bgcolor>. Use the 'show colors' command for a list\n"
"of valid colors.\n\n"
"SEE ALSO: 'show colors'\n"),
OWLCMD_ARGS("colorclass", owl_command_colorclass, OWL_CTX_INTERACTIVE,
"create a filter to color messages of the given class name",
"colorclass <class> <fgcolor> [<bgcolor>]",
"A filter will be created to color messages in <class>"
"in <fgcolor>,<bgcolor>. Use the 'show colors' command for a list\n"
"of valid colors.\n\n"
"SEE ALSO: 'show colors'\n"),
OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE,
"view messages matching a filter",
"view [<viewname>] [-f <filter> | --home | -r ] [-s <style>]\n"
"view <filter>\n"
"view -d <expression>\n"
"view --home",
"The view command sets information associated with a particular view,\n"
"such as view's filter or style. In the first general usage listed\n"
"above <viewname> is the name of the view to be changed. If not\n"
"specified the default view 'main' will be used. A filter can be set\n"
"for the view by listing a named filter after the -f argument. If\n"
"the --home argument is used the filter will be set to the filter named\n"
"by the\n 'view_home' variable. The style can be set by listing the\n"
"name style after the -s argument.\n"
"\n"
"The other usages listed above are abbreviated forms that simply set\n"
"the filter of the current view. The -d option allows you to write a\n"
"filter expression that will be dynamically created by BarnOwl and then\n"
"applied as the view's filter\n"
"SEE ALSO: filter, viewclass, viewuser\n"),
OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE,
"view only messages similar to the current message",
"smartnarrow [-i | --instance] [-r | --related]",
"If the curmsg is a personal message narrow\n"
" to the conversation with that user.\n"
"If the curmsg is a <MESSAGE, foo, *>\n"
" message, narrow to the instance.\n"
"If the curmsg is a class message, narrow\n"
" to the class.\n"
"If the curmsg is a class message and '-i' is specified\n"
" then narrow to the class and instance.\n"
"If '-r' or '--related' is specified, behave as though the\n"
" 'narrow-related' variable was inverted."),
OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE,
"returns the name of a filter based on the current message",
"smartfilter [-i | --instance]",
"If the curmsg is a personal message, the filter is\n"
" the conversation with that user.\n"
"If the curmsg is a <MESSAGE, foo, *>\n"
" message, the filter is to that instance.\n"
"If the curmsg is a class message, the filter is that class.\n"
"If the curmsg is a class message and '-i' is specified\n"
" the filter is to that class and instance.\n"),
OWLCMD_ARGS("viewclass", owl_command_viewclass, OWL_CTX_INTERACTIVE,
"view messages matching a particular class",
"viewclass <class>",
"The viewclass command will automatically create a filter\n"
"matching the specified class and switch the current view\n"
"to it.\n\n"
"SEE ALSO: filter, view, viewuser\n"),
OWLCMD_ALIAS("vc", "viewclass"),
OWLCMD_ARGS("viewuser", owl_command_viewuser, OWL_CTX_INTERACTIVE,
"view messages matching a particular user",
"viewuser <user>",
"The viewuser command will automatically create a filter\n"
"matching the specified user and switch the current\n"
"view to it.\n\n"
"SEE ALSO: filter, view, viewclass\n"),
OWLCMD_ALIAS("vu", "viewuser"),
OWLCMD_ALIAS("viewperson", "viewuser"),
OWLCMD_ALIAS("vp", "viewuser"),
OWLCMD_ARGS("show", owl_command_show, OWL_CTX_INTERACTIVE,
"show information",
"show colors\n"
"show commands\n"
"show command <command>\n"
"show errors\n"
"show filters\n"
"show filter <filter>\n"
"show keymaps\n"
"show keymap <keymap>\n"
"show license\n"
"show quickstart\n"
"show startup\n"
"show status\n"
"show styles\n"
"show subscriptions / show subs\n"
"show terminal\n"
"show variables\n"
"show variable <variable>\n"
"show version\n"
"show view [<view>]\n"
"show zpunts\n",
"Show colors will display a list of valid colors for the\n"
" terminal."
"Show filters will list the names of all filters.\n"
"Show filter <filter> will show the definition of a particular\n"
" filter.\n\n"
"Show startup will display the custom startup config\n\n"
"Show zpunts will show the active zpunt filters.\n\n"
"Show keymaps will list the names of all keymaps.\n"
"Show keymap <keymap> will show the key bindings in a keymap.\n\n"
"Show commands will list the names of all keymaps.\n"
"Show command <command> will provide information about a command.\n\n"
"Show styles will list the names of all styles available\n"
"for formatting messages.\n\n"
"Show variables will list the names of all variables.\n\n"
"Show errors will show a list of errors encountered by BarnOwl.\n\n"
"SEE ALSO: filter, view, alias, bindkey, help\n"),
OWLCMD_ARGS("delete", owl_command_delete, OWL_CTX_INTERACTIVE,
"mark a message for deletion",
"delete [ -id msgid ] [ --no-move ]\n"
"delete view\n"
"delete trash",
"If no message id is specified the current message is marked\n"
"for deletion. Otherwise the message with the given message\n"
"id is marked for deletion.\n"
"If '--no-move' is specified, don't move after deletion.\n"
"If 'trash' is specified, deletes all trash/auto messages\n"
"in the current view.\n"
"If 'view' is specified, deletes all messages in the\n"
"current view.\n"),
OWLCMD_ALIAS("del", "delete"),
OWLCMD_ARGS("delete-and-expunge", owl_command_delete_and_expunge, OWL_CTX_INTERACTIVE,
"delete a message",
"delete-and-expunge [-id msgid] [-q | --quiet]",
"If no message id is specified the current message is deleted.\n"
"Otherwise the message with the given message id is deleted.\n"
"If --quiet is specified, then there is no message displayed on\n"
"success.\n"),
OWLCMD_ALIAS("delx", "delete-and-expunge"),
OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE,
"unmark a message for deletion",
"undelete [ -id msgid ] [ --no-move ]\n"
"undelete view",
"If no message id is specified the current message is\n"
"unmarked for deletion. Otherwise the message with the\n"
"given message id is unmarked for deletion.\n"
"If '--no-move' is specified, don't move after deletion.\n"
"If 'view' is specified, undeletes all messages\n"
"in the current view.\n"),
OWLCMD_ALIAS("undel", "undelete"),
OWLCMD_VOID("beep", owl_command_beep, OWL_CTX_ANY,
"ring the terminal bell",
"beep",
"Beep will ring the terminal bell.\n"
"If the variable 'bell' has been\n"
"set to 'off' this command does nothing.\n"),
OWLCMD_ARGS("debug", owl_command_debug, OWL_CTX_ANY,
"prints a message into the debug log",
"debug <message>", ""),
OWLCMD_ARGS("getview", owl_command_getview, OWL_CTX_INTERACTIVE,
"returns the name of the filter for the current view",
"", ""),
OWLCMD_ARGS("getvar", owl_command_getvar, OWL_CTX_INTERACTIVE,
"returns the value of a variable",
"getvar <varname>", ""),
OWLCMD_ARGS("getfilter", owl_command_getfilter, OWL_CTX_INTERACTIVE,
"returns the definition of a filter",
"getfilter <filtername>", ""),
OWLCMD_ARGS("getstyle", owl_command_getstyle, OWL_CTX_INTERACTIVE,
"returns the name of the style for the current view",
"", ""),
OWLCMD_ARGS("search", owl_command_search, OWL_CTX_INTERACTIVE,
"search messages for a particular string",
"search [-r] [<string>]",
"The search command will find messages that contain the\n"
"specified string and move the cursor there. If no string\n"
"argument is supplied then the previous one is used. By\n"
"default searches are done forwards; if -r is used the search\n"
"is performed backwards"),
OWLCMD_ARGS("setsearch", owl_command_setsearch, OWL_CTX_INTERACTIVE,
"set the search highlight string without searching",
"setsearch <string>",
"The setsearch command highlights all occurrences of its\n"
"argument and makes it the default argument for future\n"
"search commands, but does not move the cursor. With\n"
"no argument, it makes search highlighting inactive."),
OWLCMD_ARGS("aimlogin", owl_command_aimlogin, OWL_CTX_ANY,
"login to an AIM account",
"aimlogin <screenname> [<password>]\n",
""),
OWLCMD_ARGS("aimlogout", owl_command_aimlogout, OWL_CTX_ANY,
"logout from AIM",
"aimlogout\n",
""),
OWLCMD_ARGS("error", owl_command_error, OWL_CTX_ANY,
"Display an error message",
"error <message>",
""),
OWLCMD_ARGS("message", owl_command_message, OWL_CTX_ANY,
"Display an informative message",
"message <message>",
""),
OWLCMD_ARGS("add-cmd-history", owl_command_add_cmd_history, OWL_CTX_ANY,
"Add a command to the history",
"add-cmd-history <cmd>",
""),
OWLCMD_ARGS("with-history", owl_command_with_history, OWL_CTX_ANY,
"Run a command and store it into the history",
"with-history <cmd>",
""),
OWLCMD_VOID("yes", owl_command_yes, OWL_CTX_RECV,
"Answer yes to a question",
"yes",
""),
OWLCMD_VOID("no", owl_command_no, OWL_CTX_RECV,
"Answer no to a question",
"no",
""),
/****************************************************************/
/************************* EDIT-SPECIFIC ************************/
/****************************************************************/
OWLCMD_VOID_CTX("edit:move-next-word", owl_editwin_move_to_nextword,
OWL_CTX_EDIT,
"moves cursor forward a word",
"", ""),
OWLCMD_VOID_CTX("edit:move-prev-word", owl_editwin_move_to_previousword,
OWL_CTX_EDIT,
"moves cursor backwards a word",
"", ""),
OWLCMD_VOID_CTX("edit:move-to-buffer-start", owl_editwin_move_to_top,
OWL_CTX_EDIT,
"moves cursor to the top left (start) of the buffer",
"", ""),
OWLCMD_VOID_CTX("edit:move-to-buffer-end", owl_editwin_move_to_end,
OWL_CTX_EDIT,
"moves cursor to the bottom right (end) of the buffer",
"", ""),
OWLCMD_VOID_CTX("edit:move-to-line-end", owl_editwin_move_to_line_end,
OWL_CTX_EDIT,
"moves cursor to the end of the line",
"", ""),
OWLCMD_VOID_CTX("edit:move-to-line-start", owl_editwin_move_to_line_start,
OWL_CTX_EDIT,
"moves cursor to the beginning of the line",
"", ""),
OWLCMD_VOID_CTX("edit:move-left", owl_editwin_key_left,
OWL_CTX_EDIT,
"moves the cursor left by a character",
"", ""),
OWLCMD_VOID_CTX("edit:move-right", owl_editwin_key_right,
OWL_CTX_EDIT,
"moves the cursor right by a character",
"", ""),
OWLCMD_VOID_CTX("edit:delete-next-word", owl_editwin_delete_nextword,
OWL_CTX_EDIT,
"deletes the word to the right of the cursor",
"", ""),
OWLCMD_VOID_CTX("edit:delete-prev-word", owl_editwin_delete_previousword,
OWL_CTX_EDIT,
"deletes the word to the left of the cursor",
"", ""),
OWLCMD_VOID_CTX("edit:delete-prev-char", owl_editwin_backspace,
OWL_CTX_EDIT,
"deletes the character to the left of the cursor",
"", ""),
OWLCMD_VOID_CTX("edit:delete-next-char", owl_editwin_delete_char,
OWL_CTX_EDIT,
"deletes the character to the right of the cursor",
"", ""),
OWLCMD_VOID_CTX("edit:delete-to-line-end", owl_editwin_delete_to_endofline,
OWL_CTX_EDIT,
"deletes from the cursor to the end of the line",
"", ""),
OWLCMD_VOID_CTX("edit:delete-all", owl_editwin_clear,
OWL_CTX_EDIT,
"deletes all of the contents of the buffer",
"", ""),
OWLCMD_VOID_CTX("edit:transpose-chars", owl_editwin_transpose_chars,
OWL_CTX_EDIT,
"Interchange characters around point, moving forward one character.",
"", ""),
OWLCMD_VOID_CTX("edit:fill-paragraph", owl_editwin_fill_paragraph,
OWL_CTX_EDIT,
"fills the current paragraph to line-wrap well",
"", ""),
OWLCMD_VOID_CTX("edit:recenter", owl_editwin_recenter,
OWL_CTX_EDIT,
"recenters the buffer",
"", ""),
OWLCMD_ARGS_CTX("edit:insert-text", owl_command_edit_insert_text,
OWL_CTX_EDIT,
"inserts text into the buffer",
"edit:insert-text <text>", ""),
OWLCMD_VOID_CTX("edit:cancel", owl_command_edit_cancel,
OWL_CTX_EDIT,
"cancels the current command",
"", ""),
OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next,
OWL_CTX_EDIT,
"replaces the text with the next history",
"", ""),
OWLCMD_VOID_CTX("edit:history-prev", owl_command_edit_history_prev,
OWL_CTX_EDIT,
"replaces the text with the previous history",
"", ""),
OWLCMD_VOID_CTX("edit:set-mark", owl_editwin_set_mark,
OWL_CTX_EDIT,
"sets the mark",
"", ""),
OWLCMD_VOID_CTX("edit:exchange-point-and-mark", owl_editwin_exchange_point_and_mark,
OWL_CTX_EDIT,
"exchanges the point and the mark",
"", ""),
OWLCMD_VOID_CTX("edit:copy-region-as-kill", owl_editwin_copy_region_as_kill,
OWL_CTX_EDIT,
"copy the text between the point and the mark",
"", ""),
OWLCMD_VOID_CTX("edit:kill-region", owl_editwin_kill_region,
OWL_CTX_EDIT,
"kill text between the point and the mark",
"", ""),
OWLCMD_VOID_CTX("edit:yank", owl_editwin_yank,
OWL_CTX_EDIT,
"insert the current text from the kill buffer",
"", ""),
OWLCMD_ALIAS ("editline:done", "edit:done"),
OWLCMD_ALIAS ("editresponse:done", "edit:done"),
OWLCMD_VOID_CTX("edit:move-up-line", owl_editwin_key_up,
OWL_CTX_EDITMULTI,
"moves the cursor up one line",
"", ""),
OWLCMD_VOID_CTX("edit:move-down-line", owl_editwin_key_down,
OWL_CTX_EDITMULTI,
"moves the cursor down one line",
"", ""),
OWLCMD_VOID_CTX("edit:done", owl_command_edit_done,
OWL_CTX_EDIT,
"Finishes entering text in the editwin.",
"", ""),
OWLCMD_VOID_CTX("edit:done-or-delete", owl_command_edit_done_or_delete,
OWL_CTX_EDITMULTI,
"completes the command, but only if at end of message",
"",
"If only whitespace is to the right of the cursor,\n"
"runs 'edit:done'.\n"\
"Otherwise runs 'edit:delete-next-char'\n"),
OWLCMD_VOID_CTX("edit:forward-paragraph", owl_editwin_forward_paragraph,
OWL_CTX_EDITMULTI,
"Move forward to end of paragraph.",
"",
"Move the point to the end of the current paragraph"),
OWLCMD_VOID_CTX("edit:backward-paragraph", owl_editwin_backward_paragraph,
OWL_CTX_EDITMULTI,
"Move backward to the start of paragraph.",
"",
"Move the point to the start of the current paragraph"),
/****************************************************************/
/********************** POPLESS-SPECIFIC ************************/
/****************************************************************/
OWLCMD_VOID_CTX("popless:scroll-down-page", owl_viewwin_pagedown,
OWL_CTX_POPLESS,
"scrolls down one page",
"", ""),
OWLCMD_VOID_CTX("popless:scroll-down-line", owl_viewwin_linedown,
OWL_CTX_POPLESS,
"scrolls down one line",
"", ""),
OWLCMD_VOID_CTX("popless:scroll-up-page", owl_viewwin_pageup,
OWL_CTX_POPLESS,
"scrolls up one page",
"", ""),
OWLCMD_VOID_CTX("popless:scroll-up-line", owl_viewwin_lineup,
OWL_CTX_POPLESS,
"scrolls up one line",
"", ""),
OWLCMD_VOID_CTX("popless:scroll-to-top", owl_viewwin_top,
OWL_CTX_POPLESS,
"scrolls to the top of the buffer",
"", ""),
OWLCMD_VOID_CTX("popless:scroll-to-bottom", owl_viewwin_bottom,
OWL_CTX_POPLESS,
"scrolls to the bottom of the buffer",