diff options
author | dequis <dx@dxzone.com.ar> | 2015-12-01 01:55:21 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-12-01 01:55:21 -0300 |
commit | 05aba5534a8b2ea1374b43412a56b7ca00901fcc (patch) | |
tree | 505552c86d6dacfc196062d53259904d7c5e49fb | |
parent | 03df717bf8e01754c730c3ab5e08ed6a920dcb40 (diff) |
purple: Implement PurpleNotifyUiOps.notify_message
Which has no connection context. Luckily local_bee exists, and libpurple
only supports only one irc user per process.
This sucks.
And yesterday I was naively thinking (again) that local_bee might not be
needed, that maybe we can do things properly. Of course it only took a
look at that one reverted commit (56985aa) to remember that life is
unfair, and that, under Moloch, everyone is irresistably incentivized to
ignore the things that unite us in favor of forever picking at the
things that divide us in exactly the way that is most likely to make
them more divisive. That being said, I think all these hacks are going
to look nicer once I sandbox the whole thing in a separate process with
one IM account per process, as opposed to one irc use per process. Then
we'll be able to rely on global state exclusively, which is saner.
-rw-r--r-- | protocols/purple/purple.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 911edaea..a784cc9d 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -1287,6 +1287,27 @@ static PurpleEventLoopUiOps glib_eventloops = prplcb_ev_remove, }; +/* Absolutely no connection context at all. Thanks purple! brb crying */ +static void *prplcb_notify_message(PurpleNotifyMsgType type, const char *title, + const char *primary, const char *secondary) +{ + char *text = g_strdup_printf("%s%s - %s%s%s", + (type == PURPLE_NOTIFY_MSG_ERROR) ? "Error: " : "", + title, + primary ?: "", + (primary && secondary) ? " - " : "", + secondary ?: "" + ); + + if (local_bee->ui->log) { + local_bee->ui->log(local_bee, "purple", text); + } + + g_free(text); + + return NULL; +} + static void *prplcb_notify_email(PurpleConnection *gc, const char *subject, const char *from, const char *to, const char *url) { @@ -1347,7 +1368,7 @@ static void *prplcb_notify_userinfo(PurpleConnection *gc, const char *who, Purpl static PurpleNotifyUiOps bee_notify_uiops = { - NULL, + prplcb_notify_message, prplcb_notify_email, NULL, NULL, |