Changeset 5a8afc3 for storage_xml.c
- Timestamp:
- 2016-11-21T06:58:47Z (8 years ago)
- Branches:
- master
- Children:
- 3f44e43, f8c9347
- Parents:
- 11d4123
- git-author:
- dequis <dx@…> (21-11-16 06:40:54)
- git-committer:
- dequis <dx@…> (21-11-16 06:58:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r11d4123 r5a8afc3 60 60 } 61 61 62 static void handle_settings(struct xt_node *node, set_t **head , gboolean add_unknowns)62 static void handle_settings(struct xt_node *node, set_t **head) 63 63 { 64 64 struct xt_node *c; … … 70 70 71 71 if (!name) { 72 continue;73 }74 75 if (add_unknowns && !set_find(head, name)) {76 s = set_add(head, name, NULL, NULL, NULL);77 s->flags |= ACC_SET_ONLINE_ONLY;78 s->value = g_strdup(c->text);79 72 continue; 80 73 } … … 93 86 } 94 87 } 88 } 89 } 90 91 /* Use for unsupported/not-found protocols. Save settings as-is but don't allow changes. */ 92 static void handle_settings_raw(struct xt_node *node, set_t **head) 93 { 94 struct xt_node *c; 95 96 for (c = node->children; (c = xt_find_node(c, "setting")); c = c->next) { 97 char *name = xt_find_attr(c, "name"); 98 99 if (!name) { 100 continue; 101 } 102 103 set_t *s = set_add(head, name, NULL, NULL, NULL); 104 set_setstr(head, name, c->text); 105 s->flags |= SET_HIDDEN | 106 ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY; 95 107 } 96 108 } … … 106 118 account_t *acc; 107 119 struct xt_node *c; 108 gboolean is_unknown = FALSE;109 120 110 121 handle = xt_find_attr(node, "handle"); … … 120 131 if (!prpl) { 121 132 irc_rootmsg(xd->irc, "Warning: Protocol not found: `%s'", protocol); 122 prpl = make_unknown_protocol(protocol); 123 } 124 is_unknown = (prpl->options & PRPL_OPT_UNKNOWN_PROTOCOL) != 0; 133 prpl = (struct prpl*) &protocol_missing; 134 } 125 135 local = protocol_account_islocal(protocol); 126 136 } … … 158 168 acc->flags |= ACC_FLAG_LOCKED; 159 169 } 170 if (prpl == &protocol_missing) { 171 set_t *s = set_add(&acc->set, "_protocol_name", protocol, NULL, NULL); 172 s->flags |= SET_HIDDEN | SET_NOSAVE | 173 ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY; 174 } 160 175 161 176 g_free(pass_cr); 162 177 g_free(password); 163 178 164 handle_settings(node, &acc->set, is_unknown); 179 if (prpl == &protocol_missing) { 180 handle_settings_raw(node, &acc->set); 181 } else { 182 handle_settings(node, &acc->set); 183 } 165 184 166 185 for (c = node->children; (c = xt_find_node(c, "buddy")); c = c->next) { … … 201 220 } 202 221 203 handle_settings(node, &ic->set , FALSE);222 handle_settings(node, &ic->set); 204 223 205 224 return XT_HANDLED; … … 279 298 } 280 299 281 handle_settings(node, &xd->irc->b->set , FALSE);300 handle_settings(node, &xd->irc->b->set); 282 301 283 302 error: … … 351 370 352 371 cur = xt_new_node("account", NULL, NULL); 353 xt_add_attr(cur, "protocol", acc->prpl->name); 372 if (acc->prpl == &protocol_missing) { 373 xt_add_attr(cur, "protocol", set_getstr(&acc->set, "_protocol_name")); 374 } else { 375 xt_add_attr(cur, "protocol", acc->prpl->name); 376 } 354 377 xt_add_attr(cur, "handle", acc->user); 355 378 xt_add_attr(cur, "password", pass_b64);
Note: See TracChangeset
for help on using the changeset viewer.