comparison mcabber/src/hooks.c @ 1484:7b36b91a4388

New UI message flag (O) when OTR is used When PGP is used, the flag is still '~'. When OTR is used (and PGP is not), the encryption flag is 'O'.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 Apr 2008 14:30:25 +0200
parents c6ebf66a4f80
children a087125d8fc8
comparison
equal deleted inserted replaced
1483:e74cc83e7158 1484:7b36b91a4388
68 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; 68 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
69 GSList *roster_usr; 69 GSList *roster_usr;
70 unsigned mucnicklen = 0; 70 unsigned mucnicklen = 0;
71 const char *ename = NULL; 71 const char *ename = NULL;
72 72
73 if (encrypted) 73 if (encrypted == ENCRYPTED_PGP)
74 message_flags |= HBB_PREFIX_PGPCRYPT; 74 message_flags |= HBB_PREFIX_PGPCRYPT;
75 else if (encrypted == ENCRYPTED_OTR)
76 message_flags |= HBB_PREFIX_OTRCRYPT;
75 77
76 if (type && !strcmp(type, "groupchat")) { 78 if (type && !strcmp(type, "groupchat")) {
77 rtype = ROSTER_TYPE_ROOM; 79 rtype = ROSTER_TYPE_ROOM;
78 is_groupchat = TRUE; 80 is_groupchat = TRUE;
79 log_muc_conf = settings_opt_get_int("log_muc_conf"); 81 log_muc_conf = settings_opt_get_int("log_muc_conf");
248 // normal messages. 250 // normal messages.
249 void hk_message_out(const char *bjid, const char *nick, 251 void hk_message_out(const char *bjid, const char *nick,
250 time_t timestamp, const char *msg, guint encrypted) 252 time_t timestamp, const char *msg, guint encrypted)
251 { 253 {
252 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; 254 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
255 guint cryptflag = 0;
253 256
254 if (nick) { 257 if (nick) {
255 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg); 258 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg);
256 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { 259 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) {
257 const char *mynick = roster_getnickname(bjid); 260 const char *mynick = roster_getnickname(bjid);
269 } 272 }
270 273
271 // Note: the hlog_write should not be called first, because in some 274 // Note: the hlog_write should not be called first, because in some
272 // cases scr_WriteOutgoingMessage() will load the history and we'd 275 // cases scr_WriteOutgoingMessage() will load the history and we'd
273 // have the message twice... 276 // have the message twice...
274 scr_WriteOutgoingMessage(bjid, wmsg, (encrypted ? HBB_PREFIX_PGPCRYPT : 0)); 277 if (encrypted == ENCRYPTED_PGP)
278 cryptflag = HBB_PREFIX_PGPCRYPT;
279 else if (encrypted == ENCRYPTED_OTR)
280 cryptflag = HBB_PREFIX_OTRCRYPT;
281 scr_WriteOutgoingMessage(bjid, wmsg, cryptflag);
275 282
276 // We don't log private messages 283 // We don't log private messages
277 if (!nick) 284 if (!nick)
278 hlog_write_message(bjid, timestamp, 1, msg); 285 hlog_write_message(bjid, timestamp, 1, msg);
279 286