comparison mcabber/mcabber/xmpp.c @ 2044:c00b919cf4ac

Hopefully fix #94 (OTR leak when block_unsubscribed is set)
author Mikael Berthe <mikael@lilotux.net>
date Tue, 27 Nov 2012 15:26:26 +0100
parents f8958ab545ac
children f52b47f29ca0
comparison
equal deleted inserted replaced
2043:8c51c684dd2f 2044:c00b919cf4ac
1102 // Check signature of an unencrypted message 1102 // Check signature of an unencrypted message
1103 if (node_signed && gpg_enabled()) 1103 if (node_signed && gpg_enabled())
1104 check_signature(bjid, rname, node_signed, decrypted_pgp); 1104 check_signature(bjid, rname, node_signed, decrypted_pgp);
1105 #endif 1105 #endif
1106 1106
1107 #ifdef HAVE_LIBOTR
1108 if (otr_enabled()) {
1109 decrypted_otr = (char*)body;
1110 otr_msg = otr_receive(&decrypted_otr, bjid, &free_msg);
1111 if (!decrypted_otr) {
1112 goto gotmessage_return;
1113 }
1114 body = decrypted_otr;
1115 }
1116 #endif
1117
1118 // Check for unexpected groupchat messages 1107 // Check for unexpected groupchat messages
1119 // If we receive a groupchat message from a room we're not a member of, 1108 // If we receive a groupchat message from a room we're not a member of,
1120 // this is probably a server issue and the best we can do is to send 1109 // this is probably a server issue and the best we can do is to send
1121 // a type unavailable. 1110 // a type unavailable.
1122 if (type == LM_MESSAGE_SUB_TYPE_GROUPCHAT && !roster_getnickname(bjid)) { 1111 if (type == LM_MESSAGE_SUB_TYPE_GROUPCHAT && !roster_getnickname(bjid)) {
1160 g_free(sbjid); 1149 g_free(sbjid);
1161 goto gotmessage_return; 1150 goto gotmessage_return;
1162 } 1151 }
1163 g_free(sbjid); 1152 g_free(sbjid);
1164 } 1153 }
1154
1155 #ifdef HAVE_LIBOTR
1156 if (otr_enabled()) {
1157 decrypted_otr = (char*)body;
1158 otr_msg = otr_receive(&decrypted_otr, bjid, &free_msg);
1159 if (!decrypted_otr) {
1160 goto gotmessage_return;
1161 }
1162 body = decrypted_otr;
1163 }
1164 #endif
1165 1165
1166 { // format and pass message for further processing 1166 { // format and pass message for further processing
1167 gchar *fullbody = NULL; 1167 gchar *fullbody = NULL;
1168 guint encrypted; 1168 guint encrypted;
1169 1169