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/common.h | 2 ++ otr/dllmain.cpp | 11 ++++++++--- otr/menu.cpp | 2 +- otr/options.cpp | 4 ++-- otr/otr.mdsp | 15 +++++++++------ otr/otr_private.h | 2 +- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/otr/common.h b/otr/common.h index 5d7edb0..27b9612 100644 --- a/otr/common.h +++ b/otr/common.h @@ -63,6 +63,8 @@ extern OtrlUserState otr_user_state; extern char private_key_filename[MAX_PATH]; extern char fingerprint_store_filename[MAX_PATH]; +extern char *metaproto; + // read the files named above void ReadPrivkeyFiles(); 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}; diff --git a/otr/menu.cpp b/otr/menu.cpp index 026f0fe..ee917d7 100644 --- a/otr/menu.cpp +++ b/otr/menu.cpp @@ -32,7 +32,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { goto hide_all; } - if(strcmp(proto, "MetaContacts") == 0) { + if(proto && metaproto && strcmp(proto, metaproto) == 0) { // make menu act as per most online subcontact hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if(!hContact) diff --git a/otr/options.cpp b/otr/options.cpp index 4334362..055507a 100644 --- a/otr/options.cpp +++ b/otr/options.cpp @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc); HWND hw = GetDlgItem(hwndDlg, IDC_LIST_PROTOS); for(int i = 0; i < num_protocols; i++) { - if(pppDesc[i]->type == PROTOTYPE_PROTOCOL && strcmp(pppDesc[i]->szName, "MetaContacts") != 0 + if(pppDesc[i]->type == PROTOTYPE_PROTOCOL && (metaproto == 0 || strcmp(pppDesc[i]->szName, metaproto) != 0) && CallProtoService(pppDesc[i]->szName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM == PF1_IM) { SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->szName); @@ -265,7 +265,7 @@ INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar { proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ); if(proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULE) // ignore chatrooms - && (proto && strcmp(proto, "MetaContacts") != 0)) // and MetaContacts + && (metaproto == 0 || strcmp(proto, metaproto) != 0)) // and MetaContacts { lvI.iSubItem = 0; lvI.lParam = (LPARAM)hContact; diff --git a/otr/otr.mdsp b/otr/otr.mdsp index c112bf0..bc11823 100644 --- a/otr/otr.mdsp +++ b/otr/otr.mdsp @@ -124,11 +124,14 @@ extraResourceOptions= 25=..\..\..\..\..\..\..\msys\home\sje\libotr\src\userstate.h 26=..\..\..\..\..\..\..\msys\home\sje\libotr\src\version.h [History] -dllmain.cpp,35185 -..\..\..\..\..\..\..\msys\home\sje\libotr\src\message.h,9228 -..\..\..\..\..\..\..\msys\home\sje\libotr\src\proto.h,0 -common.h,844 -..\..\..\..\..\..\..\msys\home\sje\libotr\src\proto.c,1504 -..\..\..\..\..\..\..\msys\home\sje\libotr\src\version.h,0 ..\..\..\..\..\..\..\msys\home\sje\libotr\src\context.h,1839 +..\..\..\..\..\..\..\msys\home\sje\libotr\src\version.h,0 +..\..\..\..\..\..\..\msys\home\sje\libotr\src\proto.c,1504 +common.h,1593 +..\..\..\..\..\..\..\msys\home\sje\libotr\src\proto.h,0 +..\..\..\..\..\..\..\msys\home\sje\libotr\src\message.h,9228 +dllmain.cpp,35022 +menu.cpp,1044 +options.cpp,9854 +.svn\text-base\dllmain.cpp.svn-base,34942 otr_private.h,171 diff --git a/otr/otr_private.h b/otr/otr_private.h index 804a57c..25bca84 100644 --- a/otr/otr_private.h +++ b/otr/otr_private.h @@ -5,7 +5,7 @@ #define VER_MAJOR 0 #define VER_MINOR 6 #define VER_RELEASE 0 -#define VER_BUILD 1 +#define VER_BUILD 2 #define __STRINGIZE(x) #x #define VER_STRING __STRINGIZE( VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD ) -- cgit v1.2.3