Changeset 5a8afc3
- 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)
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r11d4123 r5a8afc3 1014 1014 if (!(acc = account_get(ic->irc->b, value))) { 1015 1015 return SET_INVALID; 1016 } else if (!acc->prpl->chat_join ) {1016 } else if (!acc->prpl->chat_join && acc->prpl != &protocol_missing) { 1017 1017 irc_rootmsg(ic->irc, "Named chatrooms not supported on that account."); 1018 1018 return SET_INVALID; -
protocols/Makefile
r11d4123 r5a8afc3 13 13 14 14 # [SH] Program variables 15 objects = account.o bee.o bee_chat.o bee_ft.o bee_user.o nogaim.o unknown.o15 objects = account.o bee.o bee_chat.o bee_ft.o bee_user.o nogaim.o 16 16 17 17 -
protocols/account.c
r11d4123 r5a8afc3 75 75 s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | ACC_SET_LOCKABLE; 76 76 set_setstr(&a->set, "username", user); 77 78 if (prpl == &protocol_missing) { 79 s = set_add(&a->set, "server", NULL, set_eval_account, a); 80 s->flags |= SET_NOSAVE | SET_HIDDEN | ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY; 81 } 77 82 78 83 /* Hardcode some more clever tag guesses. */ -
protocols/nogaim.c
r11d4123 r5a8afc3 160 160 GList *protocols = NULL; 161 161 GList *disabled_protocols = NULL; 162 static struct prpl *unknown_prpl;163 162 164 163 void register_protocol(struct prpl *p) … … 190 189 GList *gl = g_list_find_custom(protocols, name, proto_name_cmp); 191 190 return gl ? gl->data: NULL; 192 }193 194 struct prpl *make_unknown_protocol(const char *name)195 {196 struct prpl *ret = g_memdup(unknown_prpl, sizeof(struct prpl));197 ret->name = g_strdup(name);198 register_protocol(ret);199 return ret;200 191 } 201 192 … … 250 241 extern void twitter_initmodule(); 251 242 extern void purple_initmodule(); 252 extern void unknown_prpl_initmodule();253 254 unknown_prpl_initmodule(&unknown_prpl);255 243 256 244 #ifdef WITH_MSN -
protocols/nogaim.h
r11d4123 r5a8afc3 159 159 /* The protocol is not suitable for OTR, see OPT_NOOTR */ 160 160 PRPL_OPT_NOOTR = 1 << 12, 161 162 /* This prpl is a placeholder for a missing protocol */163 PRPL_OPT_UNKNOWN_PROTOCOL = 1 << 13,164 161 } prpl_options_t; 165 162 … … 324 321 G_MODULE_EXPORT struct prpl *find_protocol(const char *name); 325 322 G_MODULE_EXPORT gboolean is_protocol_disabled(const char *name); 326 G_MODULE_EXPORT struct prpl *make_unknown_protocol(const char *name);327 323 G_MODULE_EXPORT char *explain_unknown_protocol(const char *name); 328 324 /* When registering a new protocol, you should allocate space for a new prpl -
root_commands.c
r11d4123 r5a8afc3 498 498 499 499 for (a = irc->b->accounts; a; a = a->next) { 500 char *con ;500 char *con = NULL, *protocol = NULL; 501 501 502 502 if (a->ic && (a->ic->flags & OPT_LOGGED_IN)) { … … 510 510 } 511 511 512 irc_rootmsg(irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con); 512 if (a->prpl == &protocol_missing) { 513 protocol = g_strdup_printf("%s (missing!)", set_getstr(&a->set, "_protocol_name")); 514 } else { 515 protocol = g_strdup(a->prpl->name); 516 } 517 518 irc_rootmsg(irc, "%2d (%s): %s, %s%s", i, a->tag, protocol, a->user, con); 519 g_free(protocol); 513 520 514 521 i++; … … 524 531 525 532 for (a = irc->b->accounts; a; a = a->next) { 526 if (!a->ic && a->auto_connect ) {533 if (!a->ic && a->auto_connect && a->prpl != &protocol_missing) { 527 534 if (strcmp(a->pass, PASSWORD_PENDING) == 0) { 528 535 irc_rootmsg(irc, "Enter password for account %s " … … 584 591 irc_rootmsg(irc, "Enter password for account %s " 585 592 "first (use /OPER)", a->tag); 593 } else if (a->prpl == &protocol_missing) { 594 char *proto = set_getstr(&a->set, "_protocol_name"); 595 char *msg = explain_unknown_protocol(proto); 596 irc_rootmsg(irc, "Unknown protocol `%s'", proto); 597 irc_rootmsg(irc, msg); 598 g_free(msg); 586 599 } else { 587 600 account_on(irc->b, a); -
storage.c
r11d4123 r5a8afc3 32 32 33 33 static GList *storage_backends = NULL; 34 35 const struct prpl protocol_missing = { 36 .name = "_unknown", 37 }; 34 38 35 39 void register_storage_backend(storage_t *backend) -
storage.h
r11d4123 r5a8afc3 63 63 G_GNUC_MALLOC GList *storage_init(const char *primary, char **migrate); 64 64 65 extern const struct prpl protocol_missing; 66 65 67 #endif /* __STORAGE_H__ */ -
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.