aboutsummaryrefslogtreecommitdiff
path: root/src/chat/messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat/messenger.c')
-rw-r--r--src/chat/messenger.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/chat/messenger.c b/src/chat/messenger.c
index 62b93e8..72ba93a 100644
--- a/src/chat/messenger.c
+++ b/src/chat/messenger.c
@@ -57,10 +57,34 @@ _chat_messenger_message(void *cls,
57{ 57{
58 MESSENGER_Application *app = (MESSENGER_Application*) cls; 58 MESSENGER_Application *app = (MESSENGER_Application*) cls;
59 59
60 if (GNUNET_CHAT_KIND_LOGIN == GNUNET_CHAT_message_get_kind(message)) 60 const enum GNUNET_CHAT_MessageKind kind = GNUNET_CHAT_message_get_kind(message);
61 application_call_event(app, event_update_profile); 61 const struct GNUNET_CHAT_Contact* sender = GNUNET_CHAT_message_get_sender(message);
62 else if (GNUNET_CHAT_KIND_TEXT == GNUNET_CHAT_message_get_kind(message)) 62
63 printf("%s\n", GNUNET_CHAT_message_get_text(message)); 63 struct GNUNET_TIME_Absolute time = GNUNET_CHAT_message_get_timestamp(message);
64
65 printf("- %d, %lu", kind, time.abs_value_us);
66
67 if (sender)
68 printf(", %s\n", GNUNET_CHAT_contact_get_name(sender));
69 else
70 printf("\n");
71
72 switch (kind)
73 {
74 case GNUNET_CHAT_KIND_LOGIN:
75 application_call_event(app, event_update_profile, NULL);
76 break;
77 case GNUNET_CHAT_KIND_TEXT:
78 printf("text: %s\n", GNUNET_CHAT_message_get_text(message));
79 break;
80 case GNUNET_CHAT_KIND_JOIN:
81 if (GNUNET_YES == GNUNET_CHAT_message_is_sent(message))
82 application_call_event(app, event_update_chats, context);
83
84 break;
85 default:
86 break;
87 }
64 88
65 return GNUNET_YES; 89 return GNUNET_YES;
66} 90}