diff options
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r-- | protocols/nogaim.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c index d6d2e8e3..608e4d33 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -159,6 +159,7 @@ GList *get_plugins() GList *protocols = NULL; GList *disabled_protocols = NULL; +static struct prpl *unknown_prpl; void register_protocol(struct prpl *p) { @@ -190,11 +191,57 @@ struct prpl *find_protocol(const char *name) return gl ? gl->data: NULL; } +struct prpl *make_unknown_protocol(const char *name) +{ + struct prpl *ret = g_memdup(unknown_prpl, sizeof(struct prpl)); + ret->name = g_strdup(name); + register_protocol(ret); + return ret; +} + gboolean is_protocol_disabled(const char *name) { return g_list_find_custom(disabled_protocols, name, proto_name_cmp) != NULL; } +/* Returns heap allocated string with text attempting to explain why a protocol is missing + * Free the return value with g_free() */ +char *explain_unknown_protocol(const char *name) +{ + char *extramsg = NULL; + + if (is_protocol_disabled(name)) { + return g_strdup("Protocol disabled in the global config (bitlbee.conf)"); + } + + if (strcmp(name, "yahoo") == 0) { + return g_strdup("The old yahoo protocol is gone, try the funyahoo++ libpurple plugin instead."); + } + +#ifdef WITH_PURPLE + if ((strcmp(name, "msn") == 0) || + (strcmp(name, "loubserp-mxit") == 0) || + (strcmp(name, "myspace") == 0)) { + return g_strdup("This protocol has been removed from your libpurple version."); + } + + if (strcmp(name, "hipchat") == 0) { + return g_strdup("This account type isn't supported by libpurple's jabber."); + } + +#else + if (strcmp(name, "aim") == 0 || strcmp(name, "icq") == 0) { + return g_strdup("This account uses libpurple specific aliases for oscar. " + "Re-add the account with `account add oscar ...'"); + } + + extramsg = "If this is a libpurple plugin, you might need to install bitlbee-libpurple instead."; +#endif + return g_strconcat("The protocol plugin is not installed or could not be loaded. " + "Use the `plugins' command to list available protocols. ", + extramsg, NULL); +} + void nogaim_init() { extern void msn_initmodule(); @@ -203,6 +250,9 @@ void nogaim_init() extern void jabber_initmodule(); extern void twitter_initmodule(); extern void purple_initmodule(); + extern void unknown_prpl_initmodule(); + + unknown_prpl_initmodule(&unknown_prpl); #ifdef WITH_MSN msn_initmodule(); |