diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-28 17:03:45 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-28 17:03:45 +0000 |
commit | a6cb86841343fcbe269c8586fc48bc13a87cbc3d (patch) | |
tree | cdfdc660b040bcae595d76b5305523681ad1194f | |
parent | c7ec23cd07f386ea33131e88dbe328622c51da78 (diff) | |
download | telepathy-logger-a6cb86841343fcbe269c8586fc48bc13a87cbc3d.tar.gz |
Fixed tpl_log_entry_text_message_type_from_str
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | telepathy-logger/log-entry-text.c | 32 |
2 files changed, 17 insertions, 20 deletions
@@ -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; } |