[ekiga] Made the loudmouth message handler a small bit better
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Made the loudmouth message handler a small bit better
- Date: Wed, 14 Sep 2011 11:31:17 +0000 (UTC)
commit 50c14f11ed286247593bd36ac5a4c1b51a4a708f
Author: Julien Puydt <jpuydt newton localdomain>
Date: Wed Sep 14 12:08:34 2011 +0200
Made the loudmouth message handler a small bit better
plugins/loudmouth/loudmouth-heap.cpp | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/loudmouth/loudmouth-heap.cpp b/plugins/loudmouth/loudmouth-heap.cpp
index 6726da6..cd32ee4 100644
--- a/plugins/loudmouth/loudmouth-heap.cpp
+++ b/plugins/loudmouth/loudmouth-heap.cpp
@@ -245,8 +245,9 @@ LM::Heap::presence_handler (LmMessage* message)
LmHandlerResult
LM::Heap::message_handler (LmMessage* message)
{
- const gchar* from_c = lm_message_node_get_attribute (lm_message_get_node (message), "from");
- const gchar* type_attr = lm_message_node_get_attribute (lm_message_get_node (message), "type");
+ LmMessageNode* node = lm_message_get_node (message);
+ const gchar* from_c = lm_message_node_get_attribute (node, "from");
+ const gchar* type_attr = lm_message_node_get_attribute (node, "type");
std::string base_jid;
if (from_c != 0) {
@@ -262,11 +263,13 @@ LM::Heap::message_handler (LmMessage* message)
|| (type_attr != NULL && strcmp (type_attr, "normal") == 0)
|| (type_attr != NULL && strcmp (type_attr, "chat") == 0)) {
- LmMessageNode* body = lm_message_node_find_child (lm_message_get_node (message), "body");
- if (lm_message_node_get_value (body) != NULL) {
+ // let's imagine it's a basic chat message
+ LmMessageNode* body = lm_message_node_find_child (node, "body");
+ if (body && lm_message_node_get_value (body) != NULL) {
dialect->push_message (item, lm_message_node_get_value (body));
}
+ // it could also be an avatar or a pubsub event or...
}
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]