Mercurial > pidgin.yaz
comparison src/conversation.c @ 4876:9567b13d0e98
[gaim-migrate @ 5206]
Added gaim_conversation_(set|get)_plugin_data(), which sets and gets
plugin-specific data. It just wraps a hashtable, and it will be replaced
sometime down the road if we move to an object framework. However, the
function will still exist as a wrapper around g_object_(set|get)_data().
I've said too much.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 23 Mar 2003 21:56:18 +0000 |
parents | 1c371e4244d6 |
children | 249382064693 |
comparison
equal
deleted
inserted
replaced
4875:26837f462a66 | 4876:9567b13d0e98 |
---|---|
872 conv->account = account; | 872 conv->account = account; |
873 conv->name = g_strdup(name); | 873 conv->name = g_strdup(name); |
874 conv->title = g_strdup(name); | 874 conv->title = g_strdup(name); |
875 conv->send_history = g_list_append(NULL, NULL); | 875 conv->send_history = g_list_append(NULL, NULL); |
876 conv->history = g_string_new(""); | 876 conv->history = g_string_new(""); |
877 conv->plugin_data = g_hash_table_new_full(g_str_hash, g_str_equal, | |
878 g_free, NULL); | |
877 | 879 |
878 if (type == GAIM_CONV_IM) | 880 if (type == GAIM_CONV_IM) |
879 { | 881 { |
880 conv->u.im = g_malloc0(sizeof(struct gaim_im)); | 882 conv->u.im = g_malloc0(sizeof(struct gaim_im)); |
881 conv->u.im->conv = conv; | 883 conv->u.im->conv = conv; |
1037 g_free(conv->u.chat); | 1039 g_free(conv->u.chat); |
1038 | 1040 |
1039 chats = g_list_remove(chats, conv); | 1041 chats = g_list_remove(chats, conv); |
1040 } | 1042 } |
1041 | 1043 |
1044 g_hash_table_destroy(conv->plugin_data); | |
1045 | |
1042 if (win != NULL) { | 1046 if (win != NULL) { |
1043 gaim_window_remove_conversation(win, | 1047 gaim_window_remove_conversation(win, |
1044 gaim_conversation_get_index(conv)); | 1048 gaim_conversation_get_index(conv)); |
1045 } | 1049 } |
1046 | 1050 |
1304 | 1308 |
1305 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) | 1309 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
1306 return NULL; | 1310 return NULL; |
1307 | 1311 |
1308 return conv->u.chat; | 1312 return conv->u.chat; |
1313 } | |
1314 | |
1315 void | |
1316 gaim_conversation_set_plugin_data(struct gaim_conversation *conv, | |
1317 const char *key, gpointer data) | |
1318 { | |
1319 if (conv == NULL || key == NULL) | |
1320 return; | |
1321 | |
1322 g_hash_table_replace(conv->plugin_data, g_strdup(key), data); | |
1323 } | |
1324 | |
1325 gpointer | |
1326 gaim_conversation_get_plugin_data(struct gaim_conversation *conv, | |
1327 const char *key) | |
1328 { | |
1329 if (conv == NULL || key == NULL) | |
1330 return NULL; | |
1331 | |
1332 return g_hash_table_lookup(conv->plugin_data, key); | |
1309 } | 1333 } |
1310 | 1334 |
1311 GList * | 1335 GList * |
1312 gaim_get_conversations(void) | 1336 gaim_get_conversations(void) |
1313 { | 1337 { |