Changeset 1917a1ec
- Timestamp:
- 2008-08-30T19:43:38Z (16 years ago)
- Branches:
- master
- Children:
- b84800d
- Parents:
- ad9feec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
rad9feec r1917a1ec 29 29 #include "arc.h" 30 30 #include "md5.h" 31 #include <glib/gstdio.h>32 31 33 32 #if GLIB_CHECK_VERSION(2,8,0) … … 55 54 char *current_setting; 56 55 account_t *current_account; 56 struct chat *current_chat; 57 set_t **current_set_head; 57 58 char *given_nick; 58 59 char *given_pass; … … 173 174 174 175 if( ( setting = xml_attr( attr_names, attr_values, "name" ) ) ) 176 { 177 if( xd->current_chat != NULL ) 178 xd->current_set_head = &xd->current_chat->set; 179 else if( xd->current_account != NULL ) 180 xd->current_set_head = &xd->current_account->set; 181 else 182 xd->current_set_head = &xd->irc->set; 183 175 184 xd->current_setting = g_strdup( setting ); 185 } 176 186 else 177 187 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, … … 195 205 } 196 206 } 207 else if( g_strcasecmp( element_name, "chat" ) == 0 ) 208 { 209 char *handle, *channel; 210 211 handle = xml_attr( attr_names, attr_values, "handle" ); 212 channel = xml_attr( attr_names, attr_values, "channel" ); 213 214 if( xd->current_account && handle && channel ) 215 { 216 xd->current_chat = chat_add( xd->irc, xd->current_account, handle, channel ); 217 } 218 else 219 { 220 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 221 "Missing attributes for %s element", element_name ); 222 } 223 } 197 224 else 198 225 { … … 215 242 xd->current_account = NULL; 216 243 } 244 else if( g_strcasecmp( element_name, "chat" ) == 0 ) 245 { 246 xd->current_chat = NULL; 247 } 217 248 } 218 249 … … 221 252 char text[text_len+1]; 222 253 struct xml_parsedata *xd = data; 223 irc_t *irc = xd->irc;224 254 225 255 strncpy( text, text_orig, text_len ); … … 234 264 else if( g_strcasecmp( g_markup_parse_context_get_element( ctx ), "setting" ) == 0 && xd->current_setting ) 235 265 { 236 set_setstr( xd->current_account ? &xd->current_account->set : &irc->set, 237 xd->current_setting, (char*) text ); 266 set_setstr( xd->current_set_head, xd->current_setting, (char*) text ); 238 267 g_free( xd->current_setting ); 239 268 xd->current_setting = NULL;
Note: See TracChangeset
for help on using the changeset viewer.