summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--telepathy-logger/log-entry-text.c32
2 files changed, 17 insertions, 20 deletions
diff --git a/TODO b/TODO
index c1632da..a193afa 100644
--- a/TODO
+++ b/TODO
@@ -1,12 +1,11 @@
Those are mini tasks still to do. They should be filed against a bug
trucker as soon as TPL will have one:
-- TplChannel TplChannelText refactoring
-- TplLogEntry refactoring
- use Private struct
- include Avatar token in logstore
- fix dbus_g_method_return_error
-- fix race condition with connecting signals in observer
+- use DBus TP spec and Co.
+- use debug.c/h
- understand if TplContact is still useful or can be substitued by a
simple TpContact
diff --git a/telepathy-logger/log-entry-text.c b/telepathy-logger/log-entry-text.c
index b741a2c..ccb6990 100644
--- a/telepathy-logger/log-entry-text.c
+++ b/telepathy-logger/log-entry-text.c
@@ -21,6 +21,8 @@
#include "log-entry-text.h"
+#include <telepathy-glib/util.h>
+
#include <telepathy-logger/util.h>
#include <telepathy-logger/log-entry.h>
@@ -177,27 +179,23 @@ tpl_log_entry_text_new (guint log_id, const gchar *chat_id,
NULL);
}
+static gchar *message_types[] = {
+ "normal",
+ "action",
+ "notice",
+ "auto-reply",
+ "delivery-report",
+ NULL };
TpChannelTextMessageType
-tpl_log_entry_text_message_type_from_str (const gchar * type_str)
+tpl_log_entry_text_message_type_from_str (const gchar *type_str)
{
- if (g_strcmp0 (type_str, "normal") == 0)
- {
- return TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
- }
- else if (g_strcmp0 (type_str, "action") == 0)
- {
- return TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION;
- }
- else if (g_strcmp0 (type_str, "notice") == 0)
- {
- return TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE;
- }
- else if (g_strcmp0 (type_str, "auto-reply") == 0)
- {
- return TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY;
- }
+ guint i;
+ for(i = 0; i < G_N_ELEMENTS (message_types); ++i)
+ if (!tp_strdiff (type_str, message_types[i]))
+ return (TpChannelTextMessageType) i;
+ /* default case */
return TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
}