summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2011-09-17 11:32:55 +0000
committererdgeist <>2011-09-17 11:32:55 +0000
commitf2918a6d876c330ac62e7f4167db6796be141580 (patch)
tree4082fef10be2d6fe37034ecfc4ef38257a379283
parent8f209c6c0c877ebb705c9c97cc78a26e48e00a52 (diff)
Enable loading formats from client
-rwxr-xr-xvchat-commands.c32
-rwxr-xr-xvchat.h1
2 files changed, 32 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) {
diff --git a/vchat.h b/vchat.h
index 5e2bff9..1b29155 100755
--- a/vchat.h
+++ b/vchat.h
@@ -90,6 +90,7 @@ extern unsigned int loggedin;
90extern char errstr[]; 90extern char errstr[];
91extern char *vchat_cl_version; 91extern char *vchat_cl_version;
92void loadcfg (char *file,void (*lineparser) (char *)); 92void loadcfg (char *file,void (*lineparser) (char *));
93void loadformats (char *file);
93void cleanup(int signal); 94void cleanup(int signal);
94 95
95/* configuration helper funktions from vchat-client.c */ 96/* configuration helper funktions from vchat-client.c */