aboutsummaryrefslogtreecommitdiff
path: root/src/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/event.c b/src/event.c
index 9bbc064..5d6d72d 100644
--- a/src/event.c
+++ b/src/event.c
@@ -235,13 +235,13 @@ event_joining_contact(MESSENGER_Application *app,
235 if (!handle) 235 if (!handle)
236 return; 236 return;
237 237
238 ui_chat_entry_update(handle, app, context);
239
240 UI_MESSAGE_Handle *message = ui_message_new( 238 UI_MESSAGE_Handle *message = ui_message_new(
241 UI_MESSAGE_STATUS, 239 UI_MESSAGE_STATUS,
242 UI_MESSAGE_CONTENT_TEXT 240 UI_MESSAGE_CONTENT_TEXT
243 ); 241 );
244 242
243 ui_message_update(message, msg);
244
245 struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 245 struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
246 msg 246 msg
247 ); 247 );
@@ -270,7 +270,8 @@ event_joining_contact(MESSENGER_Application *app,
270 message->message_box 270 message->message_box
271 ); 271 );
272 272
273 handle->chat->messages = g_list_append(handle->chat->messages, message); 273 handle->chat->messages = g_list_prepend(handle->chat->messages, message);
274 ui_chat_entry_update(handle, app, context);
274} 275}
275 276
276void 277void
@@ -325,6 +326,8 @@ event_invitation(UNUSED MESSENGER_Application *app,
325 UI_MESSAGE_CONTENT_TEXT 326 UI_MESSAGE_CONTENT_TEXT
326 ); 327 );
327 328
329 ui_message_update(message, msg);
330
328 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 331 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
329 msg 332 msg
330 ); 333 );
@@ -360,7 +363,8 @@ event_invitation(UNUSED MESSENGER_Application *app,
360 message->message_box 363 message->message_box
361 ); 364 );
362 365
363 handle->chat->messages = g_list_append(handle->chat->messages, message); 366 handle->chat->messages = g_list_prepend(handle->chat->messages, message);
367 ui_chat_entry_update(handle, app, context);
364} 368}
365 369
366void 370void
@@ -382,6 +386,8 @@ event_receive_message(UNUSED MESSENGER_Application *app,
382 file? UI_MESSAGE_CONTENT_FILE : UI_MESSAGE_CONTENT_TEXT 386 file? UI_MESSAGE_CONTENT_FILE : UI_MESSAGE_CONTENT_TEXT
383 ); 387 );
384 388
389 ui_message_update(message, msg);
390
385 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 391 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
386 msg 392 msg
387 ); 393 );
@@ -393,8 +399,8 @@ event_receive_message(UNUSED MESSENGER_Application *app,
393 msg 399 msg
394 ); 400 );
395 401
396 const char *text = GNUNET_CHAT_message_get_text(msg); 402 const gchar *text = GNUNET_CHAT_message_get_text(msg);
397 const char *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); 403 const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp);
398 404
399 if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && 405 if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) &&
400 (GNUNET_YES != sent)) 406 (GNUNET_YES != sent))
@@ -409,21 +415,11 @@ event_receive_message(UNUSED MESSENGER_Application *app,
409 gtk_label_set_text(message->text_label, text? text : ""); 415 gtk_label_set_text(message->text_label, text? text : "");
410 gtk_label_set_text(message->timestamp_label, time? time : ""); 416 gtk_label_set_text(message->timestamp_label, time? time : "");
411 417
412 if (message->read_receipt_image)
413 // TODO: check read receipt
414
415 gtk_container_add( 418 gtk_container_add(
416 GTK_CONTAINER(handle->chat->messages_listbox), 419 GTK_CONTAINER(handle->chat->messages_listbox),
417 message->message_box 420 message->message_box
418 ); 421 );
419 422
420 handle->chat->messages = g_list_append(handle->chat->messages, message); 423 handle->chat->messages = g_list_prepend(handle->chat->messages, message);
421 424 ui_chat_entry_update(handle, app, context);
422 gtk_label_set_text(handle->text_label, text? text : "");
423 gtk_label_set_text(handle->timestamp_label, time? time : "");
424
425 gtk_widget_set_visible(
426 GTK_WIDGET(handle->read_receipt_image),
427 GNUNET_YES == sent
428 );
429} 425}