aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Makefile2
-rw-r--r--protocols/nogaim.c50
-rw-r--r--protocols/nogaim.h5
3 files changed, 56 insertions, 1 deletions
diff --git a/protocols/Makefile b/protocols/Makefile
index b4565ab6..ae969bde 100644
--- a/protocols/Makefile
+++ b/protocols/Makefile
@@ -12,7 +12,7 @@ _SRCDIR_ := $(_SRCDIR_)protocols/
endif
# [SH] Program variables
-objects = account.o bee.o bee_chat.o bee_ft.o bee_user.o nogaim.o
+objects = account.o bee.o bee_chat.o bee_ft.o bee_user.o nogaim.o unknown.o
# [SH] The next two lines should contain the directory name (in $(subdirs))
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();
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. */