Dynamically load UI functions, fixed tests

This commit is contained in:
James Booth
2013-12-22 22:14:15 +00:00
parent d56f6dc39b
commit 5a5b1340aa
13 changed files with 810 additions and 822 deletions

View File

@@ -39,16 +39,17 @@
static void _notify(const char * const message, int timeout,
const char * const category);
void
notifier_init(void)
static void
_notifier_init(void)
{
#ifdef HAVE_LIBNOTIFY
notify_init("Profanity");
#endif
}
void (*notifier_init)(void) = _notifier_init;
void
notifier_uninit(void)
static void
_notifier_uninit(void)
{
#ifdef HAVE_LIBNOTIFY
if (notify_is_initted()) {
@@ -56,18 +57,20 @@ notifier_uninit(void)
}
#endif
}
void (*notifier_uninit)(void) = _notifier_uninit;
void
notify_typing(const char * const handle)
static void
_notify_typing(const char * const handle)
{
char message[strlen(handle) + 1 + 11];
sprintf(message, "%s: typing...", handle);
_notify(message, 10000, "Incoming message");
}
void (*notify_typing)(const char * const) = _notify_typing;
void
notify_invite(const char * const from, const char * const room,
static void
_notify_invite(const char * const from, const char * const room,
const char * const reason)
{
GString *message = g_string_new("Room invite\nfrom: ");
@@ -82,18 +85,21 @@ notify_invite(const char * const from, const char * const room,
g_string_free(message, TRUE);
}
void (*notify_invite)(const char * const, const char * const,
const char * const) = _notify_invite;
void
notify_message(const char * const handle, int win)
static void
_notify_message(const char * const handle, int win)
{
char message[strlen(handle) + 1 + 14];
sprintf(message, "%s: message (%d).", handle, win);
_notify(message, 10000, "incoming message");
}
void (*notify_message)(const char * const, int) = _notify_message;
void
notify_room_message(const char * const handle, const char * const room, int win)
static void
_notify_room_message(const char * const handle, const char * const room, int win)
{
GString *text = g_string_new("");
@@ -104,18 +110,21 @@ notify_room_message(const char * const handle, const char * const room, int win)
g_string_free(text, TRUE);
}
void (*notify_room_message)(const char * const, const char * const,
int) = _notify_room_message;
void
notify_subscription(const char * const from)
static void
_notify_subscription(const char * const from)
{
GString *message = g_string_new("Subscription request: \n");
g_string_append(message, from);
_notify(message->str, 10000, "Incomming message");
g_string_free(message, TRUE);
}
void (*notify_subscription)(const char * const) = _notify_subscription;
void
notify_remind(void)
static void
_notify_remind(void)
{
gint unread = ui_unread();
gint open = muc_invite_count();
@@ -158,6 +167,7 @@ notify_remind(void)
g_string_free(text, TRUE);
}
void (*notify_remind)(void) = _notify_remind;
static void
_notify(const char * const message, int timeout,