From 283b4ae7cb3ca185b9a9eb1e629b9f7278be55de Mon Sep 17 00:00:00 2001 From: sje Date: Thu, 11 Oct 2007 08:42:39 +0000 Subject: more fixes for hard-coded metacontact protocol name git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@365 4f64403b-2f21-0410-a795-97e2b3489a10 --- otr/dllmain.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'otr/dllmain.cpp') diff --git a/otr/dllmain.cpp b/otr/dllmain.cpp index 24f41ea..f4f13b7 100644 --- a/otr/dllmain.cpp +++ b/otr/dllmain.cpp @@ -34,6 +34,8 @@ OtrlUserState otr_user_state = 0; UINT_PTR TIMER_ID_CLEAR_FINISHED = 0; +char *metaproto = 0; + // plugin stuff PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), @@ -652,7 +654,7 @@ int OTRSendMessage(WPARAM wParam,LPARAM lParam){ //MessageBox(0, (char *)ccs->lParam, "OTR - sending raw message", MB_OK); char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); - if(proto && strcmp(proto, "MetaContacts") == 0) // bypass for metacontacts + if(proto && metaproto && strcmp(proto, metaproto) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINSEND, wParam, lParam); if(!proto) return 1; // error @@ -830,7 +832,7 @@ int RecvMessage(WPARAM wParam,LPARAM lParam){ OtrlTLV *tlv = 0; char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); - if(proto && strcmp(proto, "MetaContacts") == 0) // bypass for metacontacts + if(proto && metaproto && strcmp(proto, metaproto) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINRECV, wParam, lParam); if(strlen(oldmessage) > INLINE_PREFIX_LEN && strncmp(oldmessage, INLINE_PREFIX, INLINE_PREFIX_LEN) == 0) // bypass for our inline messages @@ -1013,7 +1015,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 0; } - if(ServiceExists(MS_MC_GETPROTOCOLNAME) && strcmp(proto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)) == 0) { + if(metaproto && strcmp(proto, metaproto) == 0) { HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if(!hSubContact) return 0; @@ -1245,6 +1247,9 @@ void ReadPrivkeyFiles() { } int ModulesLoaded(WPARAM wParam, LPARAM lParam) { + if(ServiceExists(MS_MC_GETPROTOCOLNAME)) + metaproto = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); + if(ServiceExists(MS_UPDATE_REGISTER)) { // register with updater Update update = {0}; -- cgit v1.2.3