Update Do At plugin (Khisanth)

This commit is contained in:
Berke Viktor 2012-06-12 20:40:42 +02:00
parent 3ae36b7855
commit bf37bd3755
1 changed files with 19 additions and 5 deletions

View File

@ -31,15 +31,23 @@ parse_command( char *word[], char *word_eol[], void *userdata ) {
break; break;
} }
channel = malloc( strlen( token ) + 1 ); channel = strdup( token );
strcpy( channel, token );
delimiter = strchr( channel, '/' ); delimiter = strchr( channel, '/' );
server = NULL; server = NULL;
if( delimiter != NULL ) { if( delimiter != NULL ) {
*delimiter = '\0'; *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 );*/ /* printf( "channel[%s] server[%s]\n", channel, server );*/
@ -50,8 +58,14 @@ parse_command( char *word[], char *word_eol[], void *userdata ) {
} }
} }
if( channel != NULL ) {
free( channel ); free( channel );
} }
if( server != NULL ) {
free( server );
}
}
} }
return XCHAT_EAT_XCHAT; return XCHAT_EAT_XCHAT;
} }
@ -62,7 +76,7 @@ xchat_plugin_init( xchat_plugin * plugin_handle, char **plugin_name,
ph = plugin_handle; ph = plugin_handle;
*plugin_name = "Do At"; *plugin_name = "Do At";
*plugin_version = "1.0"; *plugin_version = "1.0001";
*plugin_desc = "Perform an arbitrary command on multiple channels"; *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 ); xchat_hook_command( ph, "doat", XCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL );