diff options
Diffstat (limited to 'MirOTR/svcs_proto.cpp')
-rw-r--r-- | MirOTR/svcs_proto.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/MirOTR/svcs_proto.cpp b/MirOTR/svcs_proto.cpp index 2d2bde6..6e78a23 100644 --- a/MirOTR/svcs_proto.cpp +++ b/MirOTR/svcs_proto.cpp @@ -14,9 +14,8 @@ int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- char *username = contact_get_id(ccs->hContact); - if(!proto || !username) return 1; // error
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam); + if(!proto || !ccs->hContact) return 1; // error
gcry_error_t err;
char *newmessage = 0;
@@ -43,7 +42,8 @@ int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ if (!(ccs->wParam & PREF_UTF)) mir_free(oldmessage_utf);
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
- +
+ char *username = contact_get_id(ccs->hContact); err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, username, oldmessage_utf, NULL, &newmessage, add_appdata, (void*)ccs->hContact); @@ -148,9 +148,8 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ return 1; //error
else if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
-
- char *uname = contact_get_id(ccs->hContact);
- if(!uname) return 1; // error
+
+ if (!ccs->hContact) return 1; //error
char *oldmessage = pre->szMessage;
char *oldmessage_utf = NULL;
@@ -172,11 +171,13 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ ConnContext *context; //NextExpectedSMP nextMsg; + char *uname = contact_get_id(ccs->hContact); lib_cs_lock(); ignore_msg = otrl_message_receiving(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, uname, oldmessage_utf, &newmessage, &tlvs, add_appdata, (void*)ccs->hContact); lib_cs_unlock(); + mir_free(uname); if( !(pre->flags & PREF_UTF)) mir_free(oldmessage_utf); oldmessage_utf = NULL; @@ -282,8 +283,6 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ } otrl_tlv_free(tlvs); - mir_free(uname); - /* If we're supposed to ignore this incoming message (because it's a * protocol message), set it to NULL, so that other plugins that * catch receiving-im-msg don't return 0, and cause it to be |