comparison mcabber/src/hooks.c @ 1055:6eb1efea75d0

PGP: Visual encryption flag
author Mikael Berthe <mikael@lilotux.net>
date Mon, 27 Nov 2006 23:39:40 +0100
parents 54405d09b15a
children c0d44a9a99bc
comparison
equal deleted inserted replaced
1054:082d55152a25 1055:6eb1efea75d0
32 #include "utils.h" 32 #include "utils.h"
33 33
34 static char *extcmd; 34 static char *extcmd;
35 35
36 inline void hk_message_in(const char *jid, const char *resname, 36 inline void hk_message_in(const char *jid, const char *resname,
37 time_t timestamp, const char *msg, const char *type) 37 time_t timestamp, const char *msg, const char *type,
38 guint encrypted)
38 { 39 {
39 int new_guy = FALSE; 40 int new_guy = FALSE;
40 int is_groupchat = FALSE; // groupchat message 41 int is_groupchat = FALSE; // groupchat message
41 int is_room = FALSE; // window is a room window 42 int is_room = FALSE; // window is a room window
42 int log_muc_conf = FALSE; 43 int log_muc_conf = FALSE;
43 int message_flags = 0; 44 int message_flags = 0;
44 guint rtype = ROSTER_TYPE_USER; 45 guint rtype = ROSTER_TYPE_USER;
45 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; 46 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
46 GSList *roster_usr; 47 GSList *roster_usr;
48
49 if (encrypted)
50 message_flags |= HBB_PREFIX_PGPCRYPT;
47 51
48 if (type && !strcmp(type, "groupchat")) { 52 if (type && !strcmp(type, "groupchat")) {
49 rtype = ROSTER_TYPE_ROOM; 53 rtype = ROSTER_TYPE_ROOM;
50 is_groupchat = TRUE; 54 is_groupchat = TRUE;
51 log_muc_conf = settings_opt_get_int("log_muc_conf"); 55 log_muc_conf = settings_opt_get_int("log_muc_conf");
163 167
164 // hk_message_out() 168 // hk_message_out()
165 // nick should be set for private messages in a chat room, and null for 169 // nick should be set for private messages in a chat room, and null for
166 // normal messages. 170 // normal messages.
167 inline void hk_message_out(const char *jid, const char *nick, 171 inline void hk_message_out(const char *jid, const char *nick,
168 time_t timestamp, const char *msg) 172 time_t timestamp, const char *msg, guint encrypted)
169 { 173 {
170 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; 174 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
171 175
172 if (nick) { 176 if (nick) {
173 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg); 177 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg);
182 } 186 }
183 187
184 // Note: the hlog_write should not be called first, because in some 188 // Note: the hlog_write should not be called first, because in some
185 // cases scr_WriteOutgoingMessage() will load the history and we'd 189 // cases scr_WriteOutgoingMessage() will load the history and we'd
186 // have the message twice... 190 // have the message twice...
187 scr_WriteOutgoingMessage(jid, wmsg); 191 scr_WriteOutgoingMessage(jid, wmsg, (encrypted ? HBB_PREFIX_PGPCRYPT : 0));
188 192
189 // We don't log private messages 193 // We don't log private messages
190 if (!nick) hlog_write_message(jid, timestamp, TRUE, msg); 194 if (!nick) hlog_write_message(jid, timestamp, TRUE, msg);
191 195
192 // External command 196 // External command