summary refs log blame commit diff stats
path: root/src/common/tree.h
blob: b1b66aa92a59916de48e7a994f30721f22056afb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                               
#ifndef XCHAT_TREE_H
#define XCHAT_TREE_H

typedef struct _tree tree;

typedef int (tree_cmp_func) (const void *keya, const void *keyb, void *data);
typedef int (tree_traverse_func) (const void *key, void *data);

tree *tree_new (tree_cmp_func *cmp, void *data);
void tree_destroy (tree *t);
void *tree_find (tree *t, void *key, tree_cmp_func *cmp, void *data, int *pos);
int tree_remove (tree *t, void *key, int *pos);
void tree_foreach (tree *t, tree_traverse_func *func, void *data);
int tree_insert (tree *t, void *key);

#endif
class="w"> if( word[2] != NULL && word[3] != NULL ) { for( str1 = word[2]; ; str1 = NULL ) { /* token = strtok_r( str1, ",", &save_ptr1 );*/ token = strtok( str1, "," ); /* printf( "token: %s\n", token );*/ if( token == NULL ) { break; } channel = strdup( token ); delimiter = strchr( channel, '/' ); server = NULL; if( delimiter != NULL ) { *delimiter = '\0'; 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 );*/ if( (ctx = hexchat_find_context( ph, server, channel ) ) != NULL ) { if( hexchat_set_context( ph, ctx ) ) { hexchat_command( ph, word_eol[3] ); } } if( channel != NULL ) { free( channel ); } if( server != NULL ) { free( server ); } } } return HEXCHAT_EAT_HEXCHAT; } int hexchat_plugin_init( hexchat_plugin * plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg ) { ph = plugin_handle; *plugin_name = "Do At"; *plugin_version = "1.0001"; *plugin_desc = "Perform an arbitrary command on multiple channels"; hexchat_hook_command( ph, "doat", HEXCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL ); hexchat_print (ph, "Do At plugin loaded\n"); return 1; } int hexchat_plugin_deinit (void) { hexchat_print (ph, "Do At plugin unloaded\n"); return 1; }