209 |
209 |
210 if (encrypted == ENCRYPTED_PGP) |
210 if (encrypted == ENCRYPTED_PGP) |
211 message_flags |= HBB_PREFIX_PGPCRYPT; |
211 message_flags |= HBB_PREFIX_PGPCRYPT; |
212 else if (encrypted == ENCRYPTED_OTR) |
212 else if (encrypted == ENCRYPTED_OTR) |
213 message_flags |= HBB_PREFIX_OTRCRYPT; |
213 message_flags |= HBB_PREFIX_OTRCRYPT; |
|
214 |
|
215 if (carbon) |
|
216 message_flags |= HBB_PREFIX_CARBON; |
214 |
217 |
215 if (type == LM_MESSAGE_SUB_TYPE_GROUPCHAT) { |
218 if (type == LM_MESSAGE_SUB_TYPE_GROUPCHAT) { |
216 rtype = ROSTER_TYPE_ROOM; |
219 rtype = ROSTER_TYPE_ROOM; |
217 is_groupchat = TRUE; |
220 is_groupchat = TRUE; |
218 log_muc_conf = settings_opt_get_int("log_muc_conf"); |
221 log_muc_conf = settings_opt_get_int("log_muc_conf"); |
445 // hk_message_out() |
448 // hk_message_out() |
446 // nick should be set for private messages in a chat room, and null for |
449 // nick should be set for private messages in a chat room, and null for |
447 // normal messages. |
450 // normal messages. |
448 void hk_message_out(const char *bjid, const char *nick, |
451 void hk_message_out(const char *bjid, const char *nick, |
449 time_t timestamp, const char *msg, |
452 time_t timestamp, const char *msg, |
450 guint encrypted, gpointer xep184) |
453 guint encrypted, gboolean carbon, gpointer xep184) |
451 { |
454 { |
452 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; |
455 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; |
453 guint cryptflag = 0; |
456 guint message_flags = 0; |
454 |
457 |
455 if (nick) { |
458 if (nick) { |
456 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg); |
459 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg); |
457 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { |
460 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { |
458 const char *mynick = roster_getnickname(bjid); |
461 const char *mynick = roster_getnickname(bjid); |
472 |
475 |
473 // Note: the hlog_write should not be called first, because in some |
476 // Note: the hlog_write should not be called first, because in some |
474 // cases scr_write_outgoing_message() will load the history and we'd |
477 // cases scr_write_outgoing_message() will load the history and we'd |
475 // have the message twice... |
478 // have the message twice... |
476 if (encrypted == ENCRYPTED_PGP) |
479 if (encrypted == ENCRYPTED_PGP) |
477 cryptflag = HBB_PREFIX_PGPCRYPT; |
480 message_flags |= HBB_PREFIX_PGPCRYPT; |
478 else if (encrypted == ENCRYPTED_OTR) |
481 else if (encrypted == ENCRYPTED_OTR) |
479 cryptflag = HBB_PREFIX_OTRCRYPT; |
482 message_flags |= HBB_PREFIX_OTRCRYPT; |
480 scr_write_outgoing_message(bjid, wmsg, cryptflag, xep184); |
483 |
|
484 if (carbon) |
|
485 message_flags |= HBB_PREFIX_CARBON; |
|
486 |
|
487 scr_write_outgoing_message(bjid, wmsg, message_flags, xep184); |
481 |
488 |
482 // We don't log private messages |
489 // We don't log private messages |
483 if (!nick) |
490 if (!nick) |
484 hlog_write_message(bjid, timestamp, 1, msg); |
491 hlog_write_message(bjid, timestamp, 1, msg); |
485 |
492 |