summaryrefslogtreecommitdiff
path: root/vchat-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'vchat-commands.c')
-rwxr-xr-xvchat-commands.c72
1 files changed, 43 insertions, 29 deletions
diff --git a/vchat-commands.c b/vchat-commands.c
index 8a4f475..651878c 100755
--- a/vchat-commands.c
+++ b/vchat-commands.c
@@ -29,6 +29,8 @@ char *vchat_cm_version = "$Id$";
29 29
30/* from vchat-client.c */ 30/* from vchat-client.c */
31extern int ownquit; 31extern int ownquit;
32extern int wantreconnect;
33extern int status;
32 34
33/* our "/command " table */ 35/* our "/command " table */
34enum { 36enum {
@@ -48,21 +50,23 @@ COMMAND_PMSHORT,
48COMMAND_QUERY, 50COMMAND_QUERY,
49COMMAND_QUITSHORT, 51COMMAND_QUITSHORT,
50COMMAND_PLAIN, 52COMMAND_PLAIN,
53COMMAND_RECONNECT,
51COMMAND_NONE 54COMMAND_NONE
52}; 55};
53 56
54static void command_quit ( char *tail); 57static void command_quit ( char *tail);
55static void command_user ( char *tail); 58static void command_user ( char *tail);
56static void command_pm ( char *tail); 59static void command_pm ( char *tail);
57static void command_action ( char *tail); 60static void command_action ( char *tail);
58static void command_help ( char *tail); 61static void command_help ( char *tail);
59static void command_flt ( char *tail); 62static void command_flt ( char *tail);
60static void command_lsflt ( char *tail); 63static void command_lsflt ( char *tail);
61static void command_clflt ( char *tail); 64static void command_clflt ( char *tail);
62static void command_rmflt ( char *tail); 65static void command_rmflt ( char *tail);
63 void command_version ( char *tail); 66 void command_version ( char *tail);
64static void command_none ( char *line); 67static void command_none ( char *line);
65static void command_query ( char *tail); 68static void command_query ( char *tail);
69static void command_reconnect ( char *tail);
66 70
67static void output_default ( char *tail); 71static void output_default ( char *tail);
68 72
@@ -70,23 +74,24 @@ static void output_default ( char *tail);
70 74
71static commandentry 75static commandentry
72commandtable[] = { 76commandtable[] = {
73{ COMMAND_VERSION, "VERSION", 7, command_version, SHORT_HELPTEXT_VERSION, LONG_HELPTEXT_VERSION }, 77{ COMMAND_VERSION, "VERSION", 7, command_version, SHORT_HELPTEXT_VERSION, LONG_HELPTEXT_VERSION },
74{ COMMAND_LSFLT, "LSFLT", 5, command_lsflt, NULL, LONG_HELPTEXT_LSFLT }, 78{ COMMAND_LSFLT, "LSFLT", 5, command_lsflt, NULL, LONG_HELPTEXT_LSFLT },
75{ COMMAND_RMFLT, "RMFLT", 5, command_rmflt, NULL, LONG_HELPTEXT_RMFLT }, 79{ COMMAND_RMFLT, "RMFLT", 5, command_rmflt, NULL, LONG_HELPTEXT_RMFLT },
76{ COMMAND_CLFLT, "CLFLT", 5, command_clflt, NULL, LONG_HELPTEXT_CLFLT }, 80{ COMMAND_CLFLT, "CLFLT", 5, command_clflt, NULL, LONG_HELPTEXT_CLFLT },
77{ COMMAND_HELP, "HELP", 4, command_help, SHORT_HELPTEXT_HELP, LONG_HELPTEXT_HELP }, 81{ COMMAND_HELP, "HELP", 4, command_help, SHORT_HELPTEXT_HELP, LONG_HELPTEXT_HELP },
78{ COMMAND_FILTERS, "FILTERS", 7, command_help, SHORT_HELPTEXT_FILTERS, LONG_HELPTEXT_FILTERS }, 82{ COMMAND_FILTERS, "FILTERS", 7, command_help, SHORT_HELPTEXT_FILTERS, LONG_HELPTEXT_FILTERS },
79{ COMMAND_KEYS, "KEYS", 4, command_help, SHORT_HELPTEXT_KEYS, LONG_HELPTEXT_KEYS }, 83{ COMMAND_RECONNECT, "RECONNECT", 9, command_reconnect, SHORT_HELPTEXT_RECONNECT, LONG_HELPTEXT_RECONNECT },
80{ COMMAND_QUERY, "QUERY", 5, command_query, NULL, NULL }, 84{ COMMAND_KEYS, "KEYS", 4, command_help, SHORT_HELPTEXT_KEYS, LONG_HELPTEXT_KEYS },
81{ COMMAND_QUIT, "QUIT", 4, command_quit, SHORT_HELPTEXT_QUIT, LONG_HELPTEXT_QUIT }, 85{ COMMAND_QUERY, "QUERY", 5, command_query, NULL, NULL },
82{ COMMAND_USER, "USER", 4, command_user, SHORT_HELPTEXT_USER, LONG_HELPTEXT_USER }, 86{ COMMAND_QUIT, "QUIT", 4, command_quit, SHORT_HELPTEXT_QUIT, LONG_HELPTEXT_QUIT },
83{ COMMAND_FLT, "FLT", 3, command_flt, NULL, LONG_HELPTEXT_FLT }, 87{ COMMAND_USER, "USER", 4, command_user, SHORT_HELPTEXT_USER, LONG_HELPTEXT_USER },
84{ COMMAND_PM, "MSG", 3, command_pm, SHORT_HELPTEXT_MSG, LONG_HELPTEXT_MSG }, 88{ COMMAND_FLT, "FLT", 3, command_flt, NULL, LONG_HELPTEXT_FLT },
85{ COMMAND_ACTION, "ME", 2, command_action, SHORT_HELPTEXT_ME, LONG_HELPTEXT_ME }, 89{ COMMAND_PM, "MSG", 3, command_pm, SHORT_HELPTEXT_MSG, LONG_HELPTEXT_MSG },
86{ COMMAND_PMSHORT, "M", 1, command_pm, NULL, SHORT_HELPTEXT_MSG }, 90{ COMMAND_ACTION, "ME", 2, command_action, SHORT_HELPTEXT_ME, LONG_HELPTEXT_ME },
87{ COMMAND_QUITSHORT,"Q", 1, command_quit, SHORT_HELPTEXT_QUIT, LONG_HELPTEXT_QUIT }, 91{ COMMAND_PMSHORT, "M", 1, command_pm, NULL, SHORT_HELPTEXT_MSG },
88{ COMMAND_PLAIN, "/", 1, output_default, NULL, NULL }, 92{ COMMAND_QUITSHORT, "Q", 1, command_quit, SHORT_HELPTEXT_QUIT, LONG_HELPTEXT_QUIT },
89{ COMMAND_NONE, "", 0, command_none, NULL, NULL } 93{ COMMAND_PLAIN, "/", 1, output_default, NULL, NULL },
94{ COMMAND_NONE, "", 0, command_none, NULL, NULL }
90}; 95};
91 96
92/* parse "/command" */ 97/* parse "/command" */
@@ -372,6 +377,15 @@ command_action(char *tail)
372 doaction( tail); 377 doaction( tail);
373} 378}
374 379
380/* handle a "/reconnect" request */
381static void
382command_reconnect(char *tail)
383{
384 status = 0;
385 wantreconnect = 1;
386 ownquit = 0;
387}
388
375/* handle a "/quit " exit */ 389/* handle a "/quit " exit */
376static void 390static void
377command_quit(char *tail) 391command_quit(char *tail)