From 5a8afc3f24a5308799d3960cab5726228345022d Mon Sep 17 00:00:00 2001 From: dequis Date: Mon, 21 Nov 2016 03:40:54 -0300 Subject: Manual merge with wilmer's approach to handling missing protocols Turns out he already implemented pretty much the same thing in the parson branch... last year. The differences between the two approaches are subtle (there aren't too many ways to do this, some lines are the exact same thing) but I decided I like his version better, so this mostly reverts a handful of my changes while keeping others. The main advantage of his approach is that no fake protocols are registered, no actual prpl functions are called, and the missing prpl is a singleton constant. New things compared to the implementation in the other branch: - The explain_unknown_protocol() function. - Fixed named chatrooms throwing a warning and losing the "account" setting when saving. See changes in irc_im.c - Fixed the "server" setting dropping when saving. See account.c Differences with my previous implementation: - Accounts with missing protocols don't autoconnect - 'account list' marks them as "(missing!)" --- protocols/account.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'protocols/account.c') diff --git a/protocols/account.c b/protocols/account.c index e25e40c7..1f12f56f 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -75,6 +75,11 @@ account_t *account_add(bee_t *bee, struct prpl *prpl, char *user, char *pass) s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | ACC_SET_LOCKABLE; set_setstr(&a->set, "username", user); + if (prpl == &protocol_missing) { + s = set_add(&a->set, "server", NULL, set_eval_account, a); + s->flags |= SET_NOSAVE | SET_HIDDEN | ACC_SET_OFFLINE_ONLY | ACC_SET_ONLINE_ONLY; + } + /* Hardcode some more clever tag guesses. */ strcpy(tag, prpl->name); if (strcmp(prpl->name, "oscar") == 0) { -- cgit v1.2.3