From b4f496e7e9a22768f76c13b96deb1997bab55414 Mon Sep 17 00:00:00 2001 From: dequis Date: Sat, 19 Nov 2016 04:32:48 -0300 Subject: Improve handling of unknown protocols / missing plugins Instead of failing to load the config, a fake prpl is created to load the account, keep its settings, and refuse to log in with a helpful error message. Also added a new explain_unknown_protocol() function which returns text which attempts to explain why a protocol is missing, handling several typical cases, including the future removal of several dead libpurple plugins. That message is shown when logging in to a loaded account with a missing protocol and when adding a new one with 'account add', with the difference that the latter doesn't leave a placeholder fake account. --- protocols/nogaim.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'protocols/nogaim.h') diff --git a/protocols/nogaim.h b/protocols/nogaim.h index b5a46524..3aa89c3b 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -158,6 +158,9 @@ typedef enum { /* The protocol is not suitable for OTR, see OPT_NOOTR */ PRPL_OPT_NOOTR = 1 << 12, + + /* This prpl is a placeholder for a missing protocol */ + PRPL_OPT_UNKNOWN_PROTOCOL = 1 << 13, } prpl_options_t; struct prpl { @@ -320,6 +323,8 @@ G_MODULE_EXPORT GList *get_protocols_disabled(); G_MODULE_EXPORT GSList *get_connections(); G_MODULE_EXPORT struct prpl *find_protocol(const char *name); G_MODULE_EXPORT gboolean is_protocol_disabled(const char *name); +G_MODULE_EXPORT struct prpl *make_unknown_protocol(const char *name); +G_MODULE_EXPORT char *explain_unknown_protocol(const char *name); /* When registering a new protocol, you should allocate space for a new prpl * struct, initialize it (set the function pointers to point to your * functions), finally call this function. */ -- cgit v1.2.3