Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    r098a75b rd628339  
    8383}
    8484
     85/* Use for unsupported/not-found protocols. Save settings as-is but don't allow changes. */
     86static void handle_settings_raw(struct xt_node *node, set_t **head)
     87{
     88        struct xt_node *c;
     89
     90        for (c = node->children; (c = xt_find_node(c, "setting")); c = c->next) {
     91                char *name = xt_find_attr(c, "name");
     92
     93                if (!name) {
     94                        continue;
     95                }
     96
     97                set_t *s = set_add(head, name, NULL, NULL, NULL);
     98                set_setstr(head, name, c->text);
     99                s->flags |= SET_HIDDEN |
     100                            ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY;
     101        }
     102}
     103
    85104static xt_status handle_account(struct xt_node *node, gpointer data)
    86105{
     
    89108        char *pass_b64 = NULL;
    90109        unsigned char *pass_cr = NULL;
    91         int pass_len, local = 0;
     110        int pass_len;
    92111        struct prpl *prpl = NULL;
    93112        account_t *acc;
     
    104123                prpl = find_protocol(protocol);
    105124                if (!prpl) {
    106                         irc_rootmsg(xd->irc, "Error loading user config: Protocol not found: `%s'", protocol);
    107                         return XT_ABORT;
    108                 }
    109                 local = protocol_account_islocal(protocol);
     125                        irc_rootmsg(xd->irc, "Warning: Protocol not found: `%s'", protocol);
     126                        prpl = (struct prpl*) &protocol_missing;
     127                }
    110128        }
    111129
     
    124142                        set_setstr(&acc->set, "tag", tag);
    125143                }
    126                 if (local) {
    127                         acc->flags |= ACC_FLAG_LOCAL;
     144                if (prpl == &protocol_missing) {
     145                        set_t *s = set_add(&acc->set, "_protocol_name", protocol, NULL, NULL);
     146                        s->flags |= SET_HIDDEN | SET_NOSAVE |
     147                                    ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY;
    128148                }
    129149        } else {
     
    136156        g_free(password);
    137157
    138         handle_settings(node, &acc->set);
     158        if (prpl == &protocol_missing) {
     159                handle_settings_raw(node, &acc->set);
     160        } else {
     161                handle_settings(node, &acc->set);
     162        }
    139163
    140164        for (c = node->children; (c = xt_find_node(c, "buddy")); c = c->next) {
     
    312336
    313337                cur = xt_new_node("account", NULL, NULL);
    314                 xt_add_attr(cur, "protocol", acc->prpl->name);
     338                if (acc->prpl == &protocol_missing) {
     339                        xt_add_attr(cur, "protocol", set_getstr(&acc->set, "_protocol_name"));
     340                } else {
     341                        xt_add_attr(cur, "protocol", acc->prpl->name);
     342                }
    315343                xt_add_attr(cur, "handle", acc->user);
    316344                xt_add_attr(cur, "password", pass_b64);
Note: See TracChangeset for help on using the changeset viewer.