diff options
Diffstat (limited to 'vchat-commands.c')
-rwxr-xr-x | vchat-commands.c | 72 |
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 */ |
31 | extern int ownquit; | 31 | extern int ownquit; |
32 | extern int wantreconnect; | ||
33 | extern int status; | ||
32 | 34 | ||
33 | /* our "/command " table */ | 35 | /* our "/command " table */ |
34 | enum { | 36 | enum { |
@@ -48,21 +50,23 @@ COMMAND_PMSHORT, | |||
48 | COMMAND_QUERY, | 50 | COMMAND_QUERY, |
49 | COMMAND_QUITSHORT, | 51 | COMMAND_QUITSHORT, |
50 | COMMAND_PLAIN, | 52 | COMMAND_PLAIN, |
53 | COMMAND_RECONNECT, | ||
51 | COMMAND_NONE | 54 | COMMAND_NONE |
52 | }; | 55 | }; |
53 | 56 | ||
54 | static void command_quit ( char *tail); | 57 | static void command_quit ( char *tail); |
55 | static void command_user ( char *tail); | 58 | static void command_user ( char *tail); |
56 | static void command_pm ( char *tail); | 59 | static void command_pm ( char *tail); |
57 | static void command_action ( char *tail); | 60 | static void command_action ( char *tail); |
58 | static void command_help ( char *tail); | 61 | static void command_help ( char *tail); |
59 | static void command_flt ( char *tail); | 62 | static void command_flt ( char *tail); |
60 | static void command_lsflt ( char *tail); | 63 | static void command_lsflt ( char *tail); |
61 | static void command_clflt ( char *tail); | 64 | static void command_clflt ( char *tail); |
62 | static void command_rmflt ( char *tail); | 65 | static void command_rmflt ( char *tail); |
63 | void command_version ( char *tail); | 66 | void command_version ( char *tail); |
64 | static void command_none ( char *line); | 67 | static void command_none ( char *line); |
65 | static void command_query ( char *tail); | 68 | static void command_query ( char *tail); |
69 | static void command_reconnect ( char *tail); | ||
66 | 70 | ||
67 | static void output_default ( char *tail); | 71 | static void output_default ( char *tail); |
68 | 72 | ||
@@ -70,23 +74,24 @@ static void output_default ( char *tail); | |||
70 | 74 | ||
71 | static commandentry | 75 | static commandentry |
72 | commandtable[] = { | 76 | commandtable[] = { |
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 */ | ||
381 | static void | ||
382 | command_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 */ |
376 | static void | 390 | static void |
377 | command_quit(char *tail) | 391 | command_quit(char *tail) |