aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-log-manager.c
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-03-06 19:51:58 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-06 19:51:58 +0800
commit79697ab1fc4f90646bc3495514d6e30585a2f97f (patch)
tree1dcea2b1e0d93f5db992084c449635bfcc961876 /libempathy/empathy-log-manager.c
parentd53b22689f12218cfa3b5f72fb936dd01dd08885 (diff)
downloadgsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar.gz
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar.bz2
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar.lz
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar.xz
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.tar.zst
gsoc2013-empathy-79697ab1fc4f90646bc3495514d6e30585a2f97f.zip
Only write messages to one specified log source, hardcoded at the moment.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=2590
Diffstat (limited to 'libempathy/empathy-log-manager.c')
-rw-r--r--libempathy/empathy-log-manager.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c
index 46463733f..1593ff4d0 100644
--- a/libempathy/empathy-log-manager.c
+++ b/libempathy/empathy-log-manager.c
@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <glib/gstdio.h>
+#include <telepathy-glib/util.h>
+
#include "empathy-log-manager.h"
#include "empathy-log-source-empathy.h"
#include "empathy-log-source.h"
@@ -120,26 +122,44 @@ empathy_log_manager_dup_singleton (void)
return g_object_new (EMPATHY_TYPE_LOG_MANAGER, NULL);
}
-void
+gboolean
empathy_log_manager_add_message (EmpathyLogManager *manager,
const gchar *chat_id,
gboolean chatroom,
- EmpathyMessage *message)
+ EmpathyMessage *message,
+ GError **error)
{
EmpathyLogManagerPriv *priv;
GList *l;
+ gboolean out = FALSE;
+ gboolean found = FALSE;
- g_return_if_fail (EMPATHY_IS_LOG_MANAGER (manager));
- g_return_if_fail (chat_id != NULL);
- g_return_if_fail (EMPATHY_IS_MESSAGE (message));
+ /* TODO: When multiple log sources appear with add_message implementations
+ * make this customisable. */
+ const gchar *add_source = "Empathy";
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
+ g_return_val_if_fail (chat_id != NULL, FALSE);
+ g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
priv = GET_PRIV (manager);
for (l = priv->sources; l; l = l->next)
{
- empathy_log_source_add_message (EMPATHY_LOG_SOURCE (l->data),
- chat_id, chatroom, message);
+ if (!tp_strdiff (empathy_log_source_get_name (
+ EMPATHY_LOG_SOURCE (l->data)), add_source))
+ {
+ out = empathy_log_source_add_message (EMPATHY_LOG_SOURCE (l->data),
+ chat_id, chatroom, message, error);
+ found = TRUE;
+ break;
+ }
}
+
+ if (!found)
+ DEBUG ("Failed to find chosen log source to write to.");
+
+ return out;
}
gboolean