# HG changeset patch # User Nathan Walp # Date 1070348882 0 # Node ID 1d0314b997471814147a376fd2f26a66b74b4d24 # Parent 8a826b27fcfb8e82c2d567086fe6e04d08efe5fd [gaim-migrate @ 8338] this doesn't seem to crash, so I figured I'd put it in get rid of the gaim_{buddy,chat,group}_{get,set}_setting() functions and replace them with gaim_blist_node_{get,set}_{bool,int,string} so we can have types, and clean up the code, all at the same time. committer: Tailor Script diff -r 8a826b27fcfb -r 1d0314b99747 src/blist.c --- a/src/blist.c Tue Dec 02 04:04:11 2003 +0000 +++ b/src/blist.c Tue Dec 02 07:08:02 2003 +0000 @@ -38,6 +38,20 @@ GaimBuddyList *gaimbuddylist = NULL; static GaimBlistUiOps *blist_ui_ops = NULL; +struct gaim_blist_node_setting { + enum { + GAIM_BLIST_NODE_SETTING_BOOL, + GAIM_BLIST_NODE_SETTING_INT, + GAIM_BLIST_NODE_SETTING_STRING + } type; + union { + gboolean boolean; + int integer; + char *string; + } value; +}; + + /***************************************************************************** * Private Utility functions * @@ -436,6 +450,8 @@ } } +static void gaim_blist_node_initialize_settings(GaimBlistNode* node); + GaimChat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components) { GaimChat *chat; @@ -449,8 +465,7 @@ if(alias && strlen(alias)) chat->alias = g_strdup(alias); chat->components = components; - chat->settings = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); + gaim_blist_node_initialize_settings((GaimBlistNode*)chat); ((GaimBlistNode*)chat)->type = GAIM_BLIST_CHAT_NODE; @@ -498,7 +513,7 @@ b->account = account; b->name = g_strdup(screenname); b->alias = g_strdup(alias); - b->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + gaim_blist_node_initialize_settings((GaimBlistNode*)b); ((GaimBlistNode*)b)->type = GAIM_BLIST_BUDDY_NODE; ops = gaim_blist_get_ui_ops(); @@ -751,6 +766,7 @@ c->totalsize = c->currentsize = c->online = 0; c->score = INT_MAX; + gaim_blist_node_initialize_settings((GaimBlistNode*)c); ops = gaim_blist_get_ui_ops(); if (ops != NULL && ops->new_node != NULL) @@ -799,8 +815,7 @@ g->totalsize = 0; g->currentsize = 0; g->online = 0; - g->settings = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); + gaim_blist_node_initialize_settings((GaimBlistNode*)g); ((GaimBlistNode*)g)->type = GAIM_BLIST_GROUP_NODE; ops = gaim_blist_get_ui_ops(); @@ -1078,7 +1093,7 @@ gaim_buddy_icon_unref(buddy->icon); ops->remove(gaimbuddylist, node); - g_hash_table_destroy(buddy->settings); + g_hash_table_destroy(buddy->node.settings); g_free(buddy->name); g_free(buddy->alias); g_free(buddy); @@ -1900,15 +1915,18 @@ static void parse_setting(GaimBlistNode *node, xmlnode *setting) { const char *name = xmlnode_get_attrib(setting, "name"); + const char *type = xmlnode_get_attrib(setting, "type"); char *value = xmlnode_get_data(setting); - /* XXX: replace with generic settings stuff */ - if(GAIM_BLIST_NODE_IS_GROUP(node)) - gaim_group_set_setting((GaimGroup*)node, name, value); - else if(GAIM_BLIST_NODE_IS_CHAT(node)) - gaim_chat_set_setting((GaimChat*)node, name, value); - else if(GAIM_BLIST_NODE_IS_BUDDY(node)) - gaim_buddy_set_setting((GaimBuddy*)node, name, value); + if(!value) + return; + + if(!type || !strcmp(type, "string")) + gaim_blist_node_set_string(node, name, value); + else if(!strcmp(type, "bool")) + gaim_blist_node_set_bool(node, name, atoi(value)); + else if(!strcmp(type, "int")) + gaim_blist_node_set_int(node, name, atoi(value)); g_free(value); } @@ -2206,58 +2224,61 @@ ui_ops->request_add_group(); } +static void blist_print_setting(const char *key, + struct gaim_blist_node_setting *setting, FILE *file, int indent) +{ + char *key_val, *data_val = NULL; + const char *type = NULL; + int i; + + if(!key) + return; + + switch(setting->type) { + case GAIM_BLIST_NODE_SETTING_BOOL: + type = "bool"; + data_val = g_strdup_printf("%d", setting->value.boolean); + break; + case GAIM_BLIST_NODE_SETTING_INT: + type = "int"; + data_val = g_strdup_printf("%d", setting->value.integer); + break; + case GAIM_BLIST_NODE_SETTING_STRING: + if(!setting->value.string) + return; + + type = "string"; + data_val = g_markup_escape_text(setting->value.string, -1); + break; + } + + /* this can't happen */ + if(!type || !data_val) + return; + + for(i=0; i%s\n", key_val, type, + data_val); + + g_free(key_val); + g_free(data_val); +} + static void blist_print_group_settings(gpointer key, gpointer data, gpointer user_data) { - char *key_val; - char *data_val; - FILE *file = user_data; - - if(!key || !data) - return; - - key_val = g_markup_escape_text(key, -1); - data_val = g_markup_escape_text(data, -1); - - fprintf(file, "\t\t\t%s\n", key_val, - data_val); - g_free(key_val); - g_free(data_val); + blist_print_setting(key, data, user_data, 3); } static void blist_print_buddy_settings(gpointer key, gpointer data, gpointer user_data) { - char *key_val; - char *data_val; - FILE *file = user_data; - - if(!key || !data) - return; - - key_val = g_markup_escape_text(key, -1); - data_val = g_markup_escape_text(data, -1); - - fprintf(file, "\t\t\t\t\t%s\n", key_val, - data_val); - g_free(key_val); - g_free(data_val); + blist_print_setting(key, data, user_data, 5); } static void blist_print_cnode_settings(gpointer key, gpointer data, gpointer user_data) { - char *key_val; - char *data_val; - FILE *file = user_data; - - if(!key || !data) - return; - - key_val = g_markup_escape_text(key, -1); - data_val = g_markup_escape_text(data, -1); - - fprintf(file, "\t\t\t\t%s\n", key_val, - data_val); - g_free(key_val); - g_free(data_val); + blist_print_setting(key, data, user_data, 4); } static void blist_print_chat_components(gpointer key, gpointer data, @@ -2295,7 +2316,7 @@ if(bud_alias) { fprintf(file, "\t\t\t\t\t%s\n", bud_alias); } - g_hash_table_foreach(buddy->settings, blist_print_buddy_settings, file); + g_hash_table_foreach(buddy->node.settings, blist_print_buddy_settings, file); fprintf(file, "\t\t\t\t\n"); g_free(bud_name); g_free(bud_alias); @@ -2320,7 +2341,8 @@ if(!exp_acct || gaim_group_on_account(group, exp_acct)) { char *group_name = g_markup_escape_text(group->name, -1); fprintf(file, "\t\t\n", group_name); - g_hash_table_foreach(group->settings, blist_print_group_settings, file); + g_hash_table_foreach(group->node.settings, + blist_print_group_settings, file); for(cnode = gnode->child; cnode; cnode = cnode->next) { if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { GaimContact *contact = (GaimContact*)cnode; @@ -2361,7 +2383,7 @@ } g_hash_table_foreach(chat->components, blist_print_chat_components, file); - g_hash_table_foreach(chat->settings, + g_hash_table_foreach(chat->node.settings, blist_print_cnode_settings, file); fprintf(file, "\t\t\t\n"); g_free(acct_name); @@ -2452,47 +2474,170 @@ g_free(filename_real); } -void gaim_group_set_setting(GaimGroup *g, const char *key, - const char *value) { - if(!g) + +static void gaim_blist_node_setting_free(struct gaim_blist_node_setting *setting) +{ + switch(setting->type) { + case GAIM_BLIST_NODE_SETTING_BOOL: + case GAIM_BLIST_NODE_SETTING_INT: + break; + case GAIM_BLIST_NODE_SETTING_STRING: + g_free(setting->value.string); + break; + } +} + +static void gaim_blist_node_initialize_settings(GaimBlistNode* node) +{ + if(node->settings) return; - g_hash_table_replace(g->settings, g_strdup(key), g_strdup(value)); + + node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, + (GDestroyNotify)gaim_blist_node_setting_free); +} + +void gaim_blist_node_remove_setting(GaimBlistNode *node, const char *key) +{ + g_return_if_fail(node != NULL); + g_return_if_fail(node->settings != NULL); + g_return_if_fail(key != NULL); + + g_hash_table_remove(node->settings, key); } -const char *gaim_group_get_setting(GaimGroup *g, const char *key) { - if(!g) - return NULL; - return g_hash_table_lookup(g->settings, key); + +void gaim_blist_node_set_bool(GaimBlistNode* node, const char *key, gboolean value) +{ + struct gaim_blist_node_setting *setting; + + g_return_if_fail(node != NULL); + g_return_if_fail(node->settings != NULL); + g_return_if_fail(key != NULL); + + setting = g_new0(struct gaim_blist_node_setting, 1); + setting->type = GAIM_BLIST_NODE_SETTING_BOOL; + setting->value.boolean = value; + + g_hash_table_replace(node->settings, g_strdup(key), setting); +} + +gboolean gaim_blist_node_get_bool(GaimBlistNode* node, const char *key) +{ + struct gaim_blist_node_setting *setting; + + g_return_val_if_fail(node != NULL, FALSE); + g_return_val_if_fail(node->settings != NULL, FALSE); + g_return_val_if_fail(key != NULL, FALSE); + + setting = g_hash_table_lookup(node->settings, key); + + return setting ? setting->value.boolean : FALSE; } -void gaim_chat_set_setting(GaimChat *c, const char *key, +void gaim_blist_node_set_int(GaimBlistNode* node, const char *key, int value) +{ + struct gaim_blist_node_setting *setting; + + g_return_if_fail(node != NULL); + g_return_if_fail(node->settings != NULL); + g_return_if_fail(key != NULL); + + setting = g_new0(struct gaim_blist_node_setting, 1); + setting->type = GAIM_BLIST_NODE_SETTING_STRING; + setting->value.integer = value; + + g_hash_table_replace(node->settings, g_strdup(key), setting); +} + +int gaim_blist_node_get_int(GaimBlistNode* node, const char *key) +{ + struct gaim_blist_node_setting *setting; + + g_return_val_if_fail(node != NULL, 0); + g_return_val_if_fail(node->settings != NULL, 0); + g_return_val_if_fail(key != NULL, 0); + + setting = g_hash_table_lookup(node->settings, key); + + return setting ? setting->value.integer : 0; +} + +void gaim_blist_node_set_string(GaimBlistNode* node, const char *key, const char *value) { - if(!c) - return; - g_hash_table_replace(c->settings, g_strdup(key), g_strdup(value)); + struct gaim_blist_node_setting *setting; + + g_return_if_fail(node != NULL); + g_return_if_fail(node->settings != NULL); + g_return_if_fail(key != NULL); + + setting = g_new0(struct gaim_blist_node_setting, 1); + setting->type = GAIM_BLIST_NODE_SETTING_STRING; + setting->value.string = g_strdup(value); + + g_hash_table_replace(node->settings, g_strdup(key), setting); +} + +const char *gaim_blist_node_get_string(GaimBlistNode* node, const char *key) +{ + struct gaim_blist_node_setting *setting; + + g_return_val_if_fail(node != NULL, NULL); + g_return_val_if_fail(node->settings != NULL, NULL); + g_return_val_if_fail(key != NULL, NULL); + + setting = g_hash_table_lookup(node->settings, key); + + return setting ? setting->value.string : NULL; +} + + +/* XXX: this is compatability stuff. Remove after.... oh, I dunno... 0.77 or so */ + +void gaim_group_set_setting(GaimGroup *g, const char *key, const char *value) +{ + gaim_debug_warning("blist", "gaim_group_set_setting() is deprecated\n"); + + gaim_blist_node_set_string((GaimBlistNode*)g, key, value); +} + +const char *gaim_group_get_setting(GaimGroup *g, const char *key) +{ + gaim_debug_warning("blist", "gaim_group_get_setting() is deprecated\n"); + + return gaim_blist_node_get_string((GaimBlistNode*)g, key); +} + +void gaim_chat_set_setting(GaimChat *c, const char *key, const char *value) +{ + gaim_debug_warning("blist", "gaim_chat_set_setting() is deprecated\n"); + + gaim_blist_node_set_string((GaimBlistNode*)c, key, value); } const char *gaim_chat_get_setting(GaimChat *c, const char *key) { - if(!c) - return NULL; - return g_hash_table_lookup(c->settings, key); + gaim_debug_warning("blist", "gaim_chat_get_setting() is deprecated\n"); + + return gaim_blist_node_get_string((GaimBlistNode*)c, key); } -void gaim_buddy_set_setting(GaimBuddy *b, const char *key, - const char *value) { - if(!b) - return; - g_hash_table_replace(b->settings, g_strdup(key), g_strdup(value)); +void gaim_buddy_set_setting(GaimBuddy *b, const char *key, const char *value) +{ + gaim_debug_warning("blist", "gaim_buddy_set_setting() is deprecated\n"); + + gaim_blist_node_set_string((GaimBlistNode*)b, key, value); } -const char *gaim_buddy_get_setting(GaimBuddy *b, const char *key) { - if(!b) - return NULL; - return g_hash_table_lookup(b->settings, key); +const char *gaim_buddy_get_setting(GaimBuddy *b, const char *key) +{ + gaim_debug_warning("blist", "gaim_buddy_get_setting() is deprecated\n"); + + return gaim_blist_node_get_string((GaimBlistNode*)b, key); } +/* XXX: end compat crap */ + int gaim_blist_get_group_size(GaimGroup *group, gboolean offline) { if(!group) return 0; diff -r 8a826b27fcfb -r 1d0314b99747 src/blist.h --- a/src/blist.h Tue Dec 02 04:04:11 2003 +0000 +++ b/src/blist.h Tue Dec 02 07:08:02 2003 +0000 @@ -85,6 +85,7 @@ GaimBlistNode *next; /**< The sibling after this buddy. */ GaimBlistNode *parent; /**< The parent of this node */ GaimBlistNode *child; /**< The child of this node */ + GHashTable *settings; /**< per-node settings */ void *ui_data; /**< The UI can put data here. */ }; @@ -105,7 +106,6 @@ void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */ GaimBuddyIcon *icon; /**< The buddy icon. */ GaimAccount *account; /**< the account this buddy belongs to */ - GHashTable *settings; /**< per-buddy settings from the XML buddy list, set by plugins and the likes. */ guint timer; /**< The timer handle. */ }; @@ -132,7 +132,6 @@ int totalsize; /**< The number of chats and contacts in this group */ int currentsize; /**< The number of chats and contacts in this group corresponding to online accounts */ int online; /**< The number of chats and contacts in this group who are currently online */ - GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */ }; /** @@ -144,7 +143,6 @@ char *alias; /**< The display name of this chat. */ GHashTable *components; /**< the stuff the protocol needs to know to join the chat */ GaimAccount *account; /**< The account this chat is attached to */ - GHashTable *settings; /**< per-chat settings from the XML buddy list, set by plugins and the likes. */ }; @@ -706,6 +704,64 @@ void gaim_blist_request_add_group(void); /** + * Associates a boolean with a node in the buddy list + * + * @param node The node to associate the data with + * @param key The identifier for the data + * @param value The value to set + */ +void gaim_blist_node_set_bool(GaimBlistNode *node, const char *key, gboolean value); + +/** + * Retreives a named boolean setting from a node in the buddy list + * + * @param node The node to retreive the data from + * @param key The identifier of the data + * + * @return The value, or FALSE if there is no setting + */ +gboolean gaim_blist_node_get_bool(GaimBlistNode *node, const char *key); + +/** + * Associates an integer with a node in the buddy list + * + * @param node The node to associate the data with + * @param key The identifier for the data + * @param value The value to set + */ +void gaim_blist_node_set_int(GaimBlistNode *node, const char *key, int value); + +/** + * Retreives a named integer setting from a node in the buddy list + * + * @param node The node to retreive the data from + * @param key The identifier of the data + * + * @return The value, or 0 if there is no setting + */ +int gaim_blist_node_get_int(GaimBlistNode *node, const char *key); + +/** + * Associates a string with a node in the buddy list + * + * @param node The node to associate the data with + * @param key The identifier for the data + * @param value The value to set + */ +void gaim_blist_node_set_string(GaimBlistNode *node, const char *key, + const char *value); + +/** + * Retreives a named string setting from a node in the buddy list + * + * @param node The node to retreive the data from + * @param key The identifier of the data + * + * @return The value, or NULL if there is no setting + */ +const char *gaim_blist_node_get_string(GaimBlistNode *node, const char *key); + +/** * Associates some data with the group in the xml buddy list * * @param g The group the data is associated with diff -r 8a826b27fcfb -r 1d0314b99747 src/gtkblist.c --- a/src/gtkblist.c Tue Dec 02 04:04:11 2003 +0000 +++ b/src/gtkblist.c Tue Dec 02 07:08:02 2003 +0000 @@ -522,10 +522,8 @@ static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat) { - if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) - gaim_chat_set_setting(chat, "gtk-autojoin", "true"); - else - gaim_chat_set_setting(chat, "gtk-autojoin", NULL); + gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin", + gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); gaim_blist_save(); } @@ -642,7 +640,7 @@ node = g_value_get_pointer(&val); if (GAIM_BLIST_NODE_IS_GROUP(node)) { - gaim_group_set_setting((GaimGroup *)node, "collapsed", NULL); + gaim_blist_node_set_bool(node, "collapsed", FALSE); gaim_blist_save(); } } @@ -656,7 +654,7 @@ node = g_value_get_pointer(&val); if (GAIM_BLIST_NODE_IS_GROUP(node)) { - gaim_group_set_setting((GaimGroup *)node, "collapsed", "true"); + gaim_blist_node_set_bool(node, "collapsed", TRUE); gaim_blist_save(); } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) { gaim_gtk_blist_collapse_contact_cb(NULL, node); @@ -919,14 +917,15 @@ } else if (GAIM_BLIST_NODE_IS_CHAT(node) && event->button == 3 && event->type == GDK_BUTTON_PRESS) { GaimChat *chat = (GaimChat *)node; - const char *autojoin = gaim_chat_get_setting(chat, "gtk-autojoin"); + gboolean autojoin = gaim_blist_node_get_bool((GaimBlistNode*)chat, + "gtk-autojoin"); menu = gtk_menu_new(); gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT, G_CALLBACK(gtk_blist_menu_join_cb), node, 0, 0, NULL); gaim_new_check_item(menu, _("Auto-Join"), G_CALLBACK(gtk_blist_menu_autojoin_cb), node, - (autojoin && !strcmp(autojoin, "true"))); + autojoin); gaim_new_item_from_stock(menu, _("_Alias"), GAIM_STOCK_EDIT, G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL); gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE, @@ -1849,7 +1848,7 @@ if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) return NULL; - if ((file = gaim_buddy_get_setting(b, "buddy_icon")) == NULL) + if ((file = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon")) == NULL) return NULL; buf = gdk_pixbuf_new_from_file(file, NULL); @@ -2657,15 +2656,14 @@ struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data; if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) { - if(!gaim_group_get_setting((GaimGroup*)node->parent, "collapsed")) + if(!gaim_blist_node_get_bool(node->parent, "collapsed")) expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) && gtkparentnode->contact_expanded) { expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); } if(expand) { - gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, - FALSE); + gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, FALSE); gtk_tree_path_free(expand); } } @@ -3603,7 +3601,6 @@ for(cnode = gnode->child; cnode; cnode = cnode->next) { GaimChat *chat; - const char *autojoin; if(!GAIM_BLIST_NODE_IS_CHAT(cnode)) continue; @@ -3613,9 +3610,7 @@ if(chat->account != account) continue; - autojoin = gaim_chat_get_setting(chat, "gtk-autojoin"); - - if(autojoin && !strcmp(autojoin, "true")) + if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin")) serv_join_chat(gc, chat->components); } } diff -r 8a826b27fcfb -r 1d0314b99747 src/gtkconv.c --- a/src/gtkconv.c Tue Dec 02 04:04:11 2003 +0000 +++ b/src/gtkconv.c Tue Dec 02 07:08:02 2003 +0000 @@ -5288,7 +5288,7 @@ if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv))) != NULL) { const char *file; - if((file = gaim_buddy_get_setting(buddy, "buddy_icon"))) + if((file = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); } else diff -r 8a826b27fcfb -r 1d0314b99747 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Tue Dec 02 04:04:11 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Dec 02 07:08:02 2003 +0000 @@ -1834,10 +1834,11 @@ * If for some reason the checksum is valid, but cached file is not.. * we want to know. */ - filename = gaim_buddy_get_setting(b, "buddy_icon"); + filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); if (filename != NULL) { if (g_file_test(filename, G_FILE_TEST_EXISTS)) - saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); + saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, + "icon_checksum"); } else saved_b16 = NULL; @@ -3468,7 +3469,7 @@ sn, icon, iconlen); b16 = gaim_base16_encode(iconcsum, iconcsumlen); if (b16) { - gaim_buddy_set_setting(b, "icon_checksum", b16); + gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); gaim_blist_save(); g_free(b16); } @@ -4076,7 +4077,7 @@ g_snprintf(who, sizeof(who), "%u", info->uin); serv_got_alias(gc, who, utf8); if ((b = gaim_find_buddy(gc->account, who))) { - gaim_buddy_set_setting(b, "servernick", utf8); + gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); gaim_blist_save(); } g_free(utf8); @@ -4959,7 +4960,7 @@ continue; buddy = (GaimBuddy *)bnode; if (buddy->account == gc->account) { - const char *servernick = gaim_buddy_get_setting(buddy, "servernick"); + const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)buddy, "servernick"); if (servernick) serv_got_alias(gc, buddy->name, servernick);