summaryrefslogtreecommitdiff
path: root/vchat-commands.c
diff options
context:
space:
mode:
authorerdgeist <>2011-09-17 11:32:55 +0000
committererdgeist <>2011-09-17 11:32:55 +0000
commitf2918a6d876c330ac62e7f4167db6796be141580 (patch)
tree4082fef10be2d6fe37034ecfc4ef38257a379283 /vchat-commands.c
parent8f209c6c0c877ebb705c9c97cc78a26e48e00a52 (diff)
Enable loading formats from client
Diffstat (limited to 'vchat-commands.c')
-rwxr-xr-xvchat-commands.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/vchat-commands.c b/vchat-commands.c
index 0c8ca26..5499948 100755
--- a/vchat-commands.c
+++ b/vchat-commands.c
@@ -59,6 +59,7 @@ static void command_user ( char *tail);
59static void command_pm ( char *tail); 59static void command_pm ( char *tail);
60static void command_action ( char *tail); 60static void command_action ( char *tail);
61static void command_help ( char *tail); 61static void command_help ( char *tail);
62static void command_format ( char *tail);
62static void command_flt ( char *tail); 63static void command_flt ( char *tail);
63static void command_lsflt ( char *tail); 64static void command_lsflt ( char *tail);
64static void command_clflt ( char *tail); 65static void command_clflt ( char *tail);
@@ -80,6 +81,7 @@ commandtable[] = {
80{ COMMAND_CLFLT, "CLFLT", 5, command_clflt, NULL, LONG_HELPTEXT_CLFLT }, 81{ COMMAND_CLFLT, "CLFLT", 5, command_clflt, NULL, LONG_HELPTEXT_CLFLT },
81{ COMMAND_HELP, "HELP", 4, command_help, SHORT_HELPTEXT_HELP, LONG_HELPTEXT_HELP }, 82{ COMMAND_HELP, "HELP", 4, command_help, SHORT_HELPTEXT_HELP, LONG_HELPTEXT_HELP },
82{ COMMAND_FILTERS, "FILTERS", 7, command_help, SHORT_HELPTEXT_FILTERS, LONG_HELPTEXT_FILTERS }, 83{ COMMAND_FILTERS, "FILTERS", 7, command_help, SHORT_HELPTEXT_FILTERS, LONG_HELPTEXT_FILTERS },
84{ COMMAND_FORMAT, "FORMAT", 6, command_format, NULL, NULL },
83{ COMMAND_RECONNECT, "RECONNECT", 9, command_reconnect, SHORT_HELPTEXT_RECONNECT, LONG_HELPTEXT_RECONNECT }, 85{ COMMAND_RECONNECT, "RECONNECT", 9, command_reconnect, SHORT_HELPTEXT_RECONNECT, LONG_HELPTEXT_RECONNECT },
84{ COMMAND_KEYS, "KEYS", 4, command_help, SHORT_HELPTEXT_KEYS, LONG_HELPTEXT_KEYS }, 86{ COMMAND_KEYS, "KEYS", 4, command_help, SHORT_HELPTEXT_KEYS, LONG_HELPTEXT_KEYS },
85{ COMMAND_QUERY, "QUERY", 5, command_query, NULL, NULL }, 87{ COMMAND_QUERY, "QUERY", 5, command_query, NULL, NULL },
@@ -294,7 +296,35 @@ command_pm (char *tail)
294{ 296{
295 privatemessagetx( tail ); 297 privatemessagetx( tail );
296} 298}
297 299
300static void
301command_format(char *line) {
302 struct stat testexist;
303 char * tildex = NULL;
304
305 flushout();
306 while( *line==' ') line++;
307 if(file) {
308 tildex = tilde_expand( file );
309 if(tildex && !stat(file, &testexist ))
310 loadformats(file);
311 else {
312#define BUFSIZE 4096
313 char buf[BUFSIZE];
314 snprintf( buf, BUFSIZE, "~/.vchat/sample-%s.fmt", file );
315 free(tildex);
316 tildex = tilde_expand( file );
317 if(tildex && !stat(file, &testexist ))
318 loadformats(file);
319 }
320
321 } else {
322 writeout(" Forgot to specify format file. ");
323 }
324 free(tildex);
325 showout();
326}
327
298/* handle a help request */ 328/* handle a help request */
299static void 329static void
300command_help (char *line) { 330command_help (char *line) {