Mercurial > pidgin
comparison src/blist.c @ 5906:390d32a6b130
[gaim-migrate @ 6338]
auto-join for chats in the buddy list. Yes, the interface sucks. I suck at
making interfaces. I'm sure someone more talented will make it pretty, or
maybe even HIG-y.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 16 Jun 2003 05:14:05 +0000 |
parents | 964e4f94fc56 |
children | a4f2aba0848d |
comparison
equal
deleted
inserted
replaced
5905:dbe2a2174be9 | 5906:390d32a6b130 |
---|---|
311 chat = g_new0(struct chat, 1); | 311 chat = g_new0(struct chat, 1); |
312 chat->account = account; | 312 chat->account = account; |
313 if(alias && strlen(alias)) | 313 if(alias && strlen(alias)) |
314 chat->alias = g_strdup(alias); | 314 chat->alias = g_strdup(alias); |
315 chat->components = components; | 315 chat->components = components; |
316 chat->settings = g_hash_table_new_full(g_str_hash, g_str_equal, | |
317 g_free, g_free); | |
316 | 318 |
317 ((GaimBlistNode*)chat)->type = GAIM_BLIST_CHAT_NODE; | 319 ((GaimBlistNode*)chat)->type = GAIM_BLIST_CHAT_NODE; |
318 | 320 |
319 ops = gaim_get_blist_ui_ops(); | 321 ops = gaim_get_blist_ui_ops(); |
320 | 322 |
1242 static char *blist_parser_buddy_name = NULL; | 1244 static char *blist_parser_buddy_name = NULL; |
1243 static char *blist_parser_buddy_alias = NULL; | 1245 static char *blist_parser_buddy_alias = NULL; |
1244 static char *blist_parser_setting_name = NULL; | 1246 static char *blist_parser_setting_name = NULL; |
1245 static char *blist_parser_setting_value = NULL; | 1247 static char *blist_parser_setting_value = NULL; |
1246 static GHashTable *blist_parser_buddy_settings = NULL; | 1248 static GHashTable *blist_parser_buddy_settings = NULL; |
1249 static GHashTable *blist_parser_chat_settings = NULL; | |
1247 static GHashTable *blist_parser_group_settings = NULL; | 1250 static GHashTable *blist_parser_group_settings = NULL; |
1248 static GHashTable *blist_parser_chat_components = NULL; | 1251 static GHashTable *blist_parser_chat_components = NULL; |
1249 static int blist_parser_privacy_mode = 0; | 1252 static int blist_parser_privacy_mode = 0; |
1250 static GList *tag_stack = NULL; | 1253 static GList *tag_stack = NULL; |
1251 enum { | 1254 enum { |
1384 if(account) { | 1387 if(account) { |
1385 struct chat *chat = gaim_chat_new(account, blist_parser_chat_alias, blist_parser_chat_components); | 1388 struct chat *chat = gaim_chat_new(account, blist_parser_chat_alias, blist_parser_chat_components); |
1386 struct group *g = gaim_find_group(blist_parser_group_name); | 1389 struct group *g = gaim_find_group(blist_parser_group_name); |
1387 gaim_blist_add_chat(chat,g, | 1390 gaim_blist_add_chat(chat,g, |
1388 gaim_blist_get_last_child((GaimBlistNode*)g)); | 1391 gaim_blist_get_last_child((GaimBlistNode*)g)); |
1392 if(blist_parser_chat_settings) { | |
1393 g_hash_table_destroy(chat->settings); | |
1394 chat->settings = blist_parser_chat_settings; | |
1395 } | |
1389 } | 1396 } |
1390 g_free(blist_parser_chat_alias); | 1397 g_free(blist_parser_chat_alias); |
1391 blist_parser_chat_alias = NULL; | 1398 blist_parser_chat_alias = NULL; |
1392 g_free(blist_parser_account_name); | 1399 g_free(blist_parser_account_name); |
1393 blist_parser_account_name = NULL; | 1400 blist_parser_account_name = NULL; |
1394 blist_parser_chat_components = NULL; | 1401 blist_parser_chat_components = NULL; |
1402 blist_parser_chat_settings = NULL; | |
1395 tag_stack = g_list_delete_link(tag_stack, tag_stack); | 1403 tag_stack = g_list_delete_link(tag_stack, tag_stack); |
1396 } else if(!strcmp(element_name, "person")) { | 1404 } else if(!strcmp(element_name, "person")) { |
1397 g_free(blist_parser_person_name); | 1405 g_free(blist_parser_person_name); |
1398 blist_parser_person_name = NULL; | 1406 blist_parser_person_name = NULL; |
1399 tag_stack = g_list_delete_link(tag_stack, tag_stack); | 1407 tag_stack = g_list_delete_link(tag_stack, tag_stack); |
1438 tag_stack = g_list_delete_link(tag_stack, tag_stack); | 1446 tag_stack = g_list_delete_link(tag_stack, tag_stack); |
1439 } else if(!strcmp(element_name, "setting")) { | 1447 } else if(!strcmp(element_name, "setting")) { |
1440 if(GPOINTER_TO_INT(tag_stack->next->data) == BLIST_TAG_BUDDY) { | 1448 if(GPOINTER_TO_INT(tag_stack->next->data) == BLIST_TAG_BUDDY) { |
1441 if(!blist_parser_buddy_settings) | 1449 if(!blist_parser_buddy_settings) |
1442 blist_parser_buddy_settings = g_hash_table_new_full(g_str_hash, | 1450 blist_parser_buddy_settings = g_hash_table_new_full(g_str_hash, |
1451 g_str_equal, g_free, g_free); | |
1452 if(blist_parser_setting_name && blist_parser_setting_value) { | |
1453 g_hash_table_replace(blist_parser_buddy_settings, | |
1454 g_strdup(blist_parser_setting_name), | |
1455 g_strdup(blist_parser_setting_value)); | |
1456 } | |
1457 } else if(GPOINTER_TO_INT(tag_stack->next->data) == BLIST_TAG_CHAT) { | |
1458 if(!blist_parser_chat_settings) | |
1459 blist_parser_chat_settings = g_hash_table_new_full(g_str_hash, | |
1443 g_str_equal, g_free, g_free); | 1460 g_str_equal, g_free, g_free); |
1444 if(blist_parser_setting_name && blist_parser_setting_value) { | 1461 if(blist_parser_setting_name && blist_parser_setting_value) { |
1445 g_hash_table_replace(blist_parser_buddy_settings, | 1462 g_hash_table_replace(blist_parser_buddy_settings, |
1446 g_strdup(blist_parser_setting_name), | 1463 g_strdup(blist_parser_setting_name), |
1447 g_strdup(blist_parser_setting_value)); | 1464 g_strdup(blist_parser_setting_value)); |
1736 fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); | 1753 fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); |
1737 g_free(chat_alias); | 1754 g_free(chat_alias); |
1738 } | 1755 } |
1739 g_hash_table_foreach(chat->components, | 1756 g_hash_table_foreach(chat->components, |
1740 blist_print_chat_components, file); | 1757 blist_print_chat_components, file); |
1758 /* works for chats too, I don't feel like renaming */ | |
1759 g_hash_table_foreach(chat->settings, | |
1760 blist_print_buddy_settings, file); | |
1741 fprintf(file, "\t\t\t</chat>\n"); | 1761 fprintf(file, "\t\t\t</chat>\n"); |
1742 g_free(acct_name); | 1762 g_free(acct_name); |
1743 } | 1763 } |
1744 } | 1764 } |
1745 } | 1765 } |
1900 if(!g) | 1920 if(!g) |
1901 return NULL; | 1921 return NULL; |
1902 return g_strdup(g_hash_table_lookup(g->settings, key)); | 1922 return g_strdup(g_hash_table_lookup(g->settings, key)); |
1903 } | 1923 } |
1904 | 1924 |
1925 void gaim_chat_set_setting(struct chat *c, const char *key, | |
1926 const char *value) | |
1927 { | |
1928 if(!c) | |
1929 return; | |
1930 g_hash_table_replace(c->settings, g_strdup(key), g_strdup(value)); | |
1931 } | |
1932 | |
1933 char *gaim_chat_get_setting(struct chat *c, const char *key) | |
1934 { | |
1935 if(!c) | |
1936 return NULL; | |
1937 return g_strdup(g_hash_table_lookup(c->settings, key)); | |
1938 } | |
1939 | |
1905 void gaim_buddy_set_setting(struct buddy *b, const char *key, | 1940 void gaim_buddy_set_setting(struct buddy *b, const char *key, |
1906 const char *value) { | 1941 const char *value) { |
1907 if(!b) | 1942 if(!b) |
1908 return; | 1943 return; |
1909 g_hash_table_replace(b->settings, g_strdup(key), g_strdup(value)); | 1944 g_hash_table_replace(b->settings, g_strdup(key), g_strdup(value)); |