--- a/mcabber/mcabber/hooks.c Mon Mar 22 21:32:11 2010 +0100
+++ b/mcabber/mcabber/hooks.c Mon Mar 22 21:47:22 2010 +0100
@@ -649,6 +649,30 @@
g_free(cmdline);
}
+void hk_unread_list_change(guint unread_count, guint attention_count,
+ guint muc_unread, guint muc_attention)
+{
+#ifdef MODULES_ENABLE
+ gchar *str_unread = g_strdup_printf("%u", unread_count);
+ gchar *str_attention = g_strdup_printf("%u", attention_count);
+ gchar *str_muc_unread = g_strdup_printf("%u", muc_unread);
+ gchar *str_muc_attention = g_strdup_printf("%u", muc_attention);
+ hk_arg_t args[] = {
+ { "unread", str_unread }, // All unread
+ { "attention", str_attention }, // Attention (private)
+ { "muc_unread", str_muc_unread }, // MUC unread
+ { "muc_attention", str_muc_attention }, // MUC attention (highlight)
+ { NULL, NULL },
+ };
+ hk_run_handlers(HOOK_UNREAD_LIST_CHANGE, args);
+ g_free(str_unread);
+ g_free(str_attention);
+ g_free(str_muc_unread);
+ g_free(str_muc_attention);
+#endif
+}
+
+
/* External commands */
// hk_ext_cmd_init()
--- a/mcabber/mcabber/hooks.h Mon Mar 22 21:32:11 2010 +0100
+++ b/mcabber/mcabber/hooks.h Mon Mar 22 21:47:22 2010 +0100
@@ -59,6 +59,9 @@
void hk_postconnect(void);
void hk_predisconnect(void);
+void hk_unread_list_change(guint unread_count, guint attention_count,
+ guint muc_unread, guint muc_attention);
+
void hk_ext_cmd_init(const char *command);
void hk_ext_cmd(const char *bjid, guchar type, guchar info, const char *data);
--- a/mcabber/mcabber/roster.c Mon Mar 22 21:32:11 2010 +0100
+++ b/mcabber/mcabber/roster.c Mon Mar 22 21:47:22 2010 +0100
@@ -617,24 +617,8 @@
} while (unread_ptr && unread_ptr != first_unread);
}
- {
- gchar *str_unread = g_strdup_printf("%u", unread_count);
- gchar *str_attention = g_strdup_printf("%u", attention_count);
- gchar *str_muc_unread = g_strdup_printf("%u", muc_unread);
- gchar *str_muc_attention = g_strdup_printf("%u", muc_attention);
- hk_arg_t args[] = {
- { "unread", str_unread }, // All unread
- { "attention", str_attention }, // Attention (private)
- { "muc_unread", str_muc_unread }, // MUC unread
- { "muc_attention", str_muc_attention }, // MUC attention (highlight)
- { NULL, NULL },
- };
- hk_run_handlers(HOOK_UNREAD_LIST_CHANGE, args);
- g_free(str_unread);
- g_free(str_attention);
- g_free(str_muc_unread);
- g_free(str_muc_attention);
- }
+ hk_unread_list_change(unread_count, attention_count,
+ muc_unread, muc_attention);
#endif
return unread_count;
}