comparison src/blist.c @ 8135:8f4ce853e685

[gaim-migrate @ 8840] created a convenience function, and used it. a lot. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 17 Jan 2004 19:36:29 +0000
parents 52cdf2740654
children f347c8d25cf5
comparison
equal deleted inserted replaced
8134:ea3eb461efc0 8135:8f4ce853e685
1977 1977
1978 buddy = gaim_buddy_new(account, name, alias); 1978 buddy = gaim_buddy_new(account, name, alias);
1979 gaim_blist_add_buddy(buddy, contact, group, 1979 gaim_blist_add_buddy(buddy, contact, group,
1980 gaim_blist_get_last_child((GaimBlistNode*)contact)); 1980 gaim_blist_get_last_child((GaimBlistNode*)contact));
1981 1981
1982 for(x = bnode->child; x; x = x->next) { 1982 for(x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
1983 if(x->type != NODE_TYPE_TAG || strcmp(x->name, "setting"))
1984 continue;
1985 parse_setting((GaimBlistNode*)buddy, x); 1983 parse_setting((GaimBlistNode*)buddy, x);
1986 } 1984 }
1987 1985
1988 g_free(name); 1986 g_free(name);
1989 if(alias) 1987 if(alias)
2002 if((alias = xmlnode_get_attrib(cnode, "alias"))) { 2000 if((alias = xmlnode_get_attrib(cnode, "alias"))) {
2003 gaim_contact_set_alias(contact, alias); 2001 gaim_contact_set_alias(contact, alias);
2004 } 2002 }
2005 2003
2006 for(x = cnode->child; x; x = x->next) { 2004 for(x = cnode->child; x; x = x->next) {
2007 if(x->type != NODE_TYPE_TAG) 2005 if(x->type != XMLNODE_TYPE_TAG)
2008 continue; 2006 continue;
2009 if(!strcmp(x->name, "buddy")) 2007 if(!strcmp(x->name, "buddy"))
2010 parse_buddy(group, contact, x); 2008 parse_buddy(group, contact, x);
2011 else if(strcmp(x->name, "setting")) 2009 else if(strcmp(x->name, "setting"))
2012 parse_setting((GaimBlistNode*)contact, x); 2010 parse_setting((GaimBlistNode*)contact, x);
2041 if((x = xmlnode_get_child(cnode, "alias"))) 2039 if((x = xmlnode_get_child(cnode, "alias")))
2042 alias = xmlnode_get_data(x); 2040 alias = xmlnode_get_data(x);
2043 2041
2044 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); 2042 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
2045 2043
2046 for(x = cnode->child; x; x = x->next) { 2044 for(x = xmlnode_get_child(cnode, "component"); x; x = xmlnode_get_next_twin(x)) {
2047 const char *name; 2045 const char *name;
2048 char *value; 2046 char *value;
2049 if(x->type != NODE_TYPE_TAG || strcmp(x->name, "component"))
2050 continue;
2051 2047
2052 name = xmlnode_get_attrib(x, "name"); 2048 name = xmlnode_get_attrib(x, "name");
2053 value = xmlnode_get_data(x); 2049 value = xmlnode_get_data(x);
2054 g_hash_table_replace(components, g_strdup(name), value); 2050 g_hash_table_replace(components, g_strdup(name), value);
2055 } 2051 }
2056 2052
2057 chat = gaim_chat_new(account, alias, components); 2053 chat = gaim_chat_new(account, alias, components);
2058 gaim_blist_add_chat(chat, group, 2054 gaim_blist_add_chat(chat, group,
2059 gaim_blist_get_last_child((GaimBlistNode*)group)); 2055 gaim_blist_get_last_child((GaimBlistNode*)group));
2060 2056
2061 for(x = cnode->child; x; x = x->next) { 2057 for(x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
2062 if(x->type != NODE_TYPE_TAG || strcmp(x->name, "setting"))
2063 continue;
2064 parse_setting((GaimBlistNode*)chat, x); 2058 parse_setting((GaimBlistNode*)chat, x);
2065 } 2059 }
2066 2060
2067 if(alias) 2061 if(alias)
2068 g_free(alias); 2062 g_free(alias);
2081 group = gaim_group_new(name); 2075 group = gaim_group_new(name);
2082 gaim_blist_add_group(group, 2076 gaim_blist_add_group(group,
2083 gaim_blist_get_last_sibling(gaimbuddylist->root)); 2077 gaim_blist_get_last_sibling(gaimbuddylist->root));
2084 2078
2085 for(cnode = groupnode->child; cnode; cnode = cnode->next) { 2079 for(cnode = groupnode->child; cnode; cnode = cnode->next) {
2086 if(cnode->type != NODE_TYPE_TAG) 2080 if(cnode->type != XMLNODE_TYPE_TAG)
2087 continue; 2081 continue;
2088 if(!strcmp(cnode->name, "setting")) 2082 if(!strcmp(cnode->name, "setting"))
2089 parse_setting((GaimBlistNode*)group, cnode); 2083 parse_setting((GaimBlistNode*)group, cnode);
2090 else if(!strcmp(cnode->name, "contact") || 2084 else if(!strcmp(cnode->name, "contact") ||
2091 !strcmp(cnode->name, "person")) 2085 !strcmp(cnode->name, "person"))
2120 } 2114 }
2121 2115
2122 blist = xmlnode_get_child(gaim, "blist"); 2116 blist = xmlnode_get_child(gaim, "blist");
2123 if(blist) { 2117 if(blist) {
2124 xmlnode *groupnode; 2118 xmlnode *groupnode;
2125 for(groupnode = blist->child; groupnode; groupnode = groupnode->next) { 2119 for(groupnode = xmlnode_get_child(blist, "group"); groupnode;
2126 if(groupnode->type != NODE_TYPE_TAG || 2120 groupnode = xmlnode_get_next_twin(groupnode)) {
2127 strcmp(groupnode->name, "group"))
2128 continue;
2129
2130 parse_group(groupnode); 2121 parse_group(groupnode);
2131 } 2122 }
2132 } 2123 }
2133 2124
2134 privacy = xmlnode_get_child(gaim, "privacy"); 2125 privacy = xmlnode_get_child(gaim, "privacy");
2154 2145
2155 account->perm_deny = atoi(mode); 2146 account->perm_deny = atoi(mode);
2156 2147
2157 for(x = anode->child; x; x = x->next) { 2148 for(x = anode->child; x; x = x->next) {
2158 char *name; 2149 char *name;
2159 if(x->type != NODE_TYPE_TAG) 2150 if(x->type != XMLNODE_TYPE_TAG)
2160 continue; 2151 continue;
2161 2152
2162 if(!strcmp(x->name, "permit")) { 2153 if(!strcmp(x->name, "permit")) {
2163 name = xmlnode_get_data(x); 2154 name = xmlnode_get_data(x);
2164 gaim_privacy_permit_add(account, name, TRUE); 2155 gaim_privacy_permit_add(account, name, TRUE);