diff options
author | Berke Viktor <berkeviktor@aol.com> | 2012-06-12 20:40:42 +0200 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2012-06-12 20:40:42 +0200 |
commit | bf37bd37556fbf20dfa1a6b40c56453eb1fe8d01 (patch) | |
tree | 5bec18b716cac1d70aff6fc914fa1ab7bdea653e | |
parent | 3ae36b7855a3b9b930430603d8c8f61bb934c424 (diff) |
Update Do At plugin (Khisanth)
-rw-r--r-- | plugins/doat/doat.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/plugins/doat/doat.c b/plugins/doat/doat.c index e03507f1..a0b5707a 100644 --- a/plugins/doat/doat.c +++ b/plugins/doat/doat.c @@ -31,15 +31,23 @@ parse_command( char *word[], char *word_eol[], void *userdata ) { break; } - channel = malloc( strlen( token ) + 1 ); - strcpy( channel, token ); + channel = strdup( token ); delimiter = strchr( channel, '/' ); server = NULL; if( delimiter != NULL ) { *delimiter = '\0'; - server = delimiter + 1; + + if( strlen( delimiter + 1 ) > 0 ) { + server = strdup( delimiter + 1 ); + } + } + + /* /Network form */ + if( strlen( channel ) == 0 ) { + free( channel ); + channel = NULL; } /* printf( "channel[%s] server[%s]\n", channel, server );*/ @@ -50,7 +58,13 @@ parse_command( char *word[], char *word_eol[], void *userdata ) { } } - free( channel ); + if( channel != NULL ) { + free( channel ); + } + + if( server != NULL ) { + free( server ); + } } } return XCHAT_EAT_XCHAT; @@ -62,7 +76,7 @@ xchat_plugin_init( xchat_plugin * plugin_handle, char **plugin_name, ph = plugin_handle; *plugin_name = "Do At"; - *plugin_version = "1.0"; + *plugin_version = "1.0001"; *plugin_desc = "Perform an arbitrary command on multiple channels"; xchat_hook_command( ph, "doat", XCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL ); |