summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-08 11:17:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-08 11:17:06 +0000
commit39b98d62430ee2a762db94822c2da05b2065d021 (patch)
tree9a9e551d19fe9beae45ec1edadd6d8fec023efe9
parent607e8d87185d4388f3bc8a9797075eb99e472ee1 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1812 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/FileAsMessage/src/main.cpp20
-rw-r--r--plugins/MetaContacts/src/meta_utils.cpp5
-rw-r--r--plugins/MirOTR/MirOTR/dllmain.cpp22
-rwxr-xr-xplugins/New_GPG/src/init.cpp15
-rw-r--r--plugins/Scriver/src/chat/clist.cpp31
-rw-r--r--plugins/SecureIM/src/svcs_menu.cpp14
-rw-r--r--protocols/YAMN/services.cpp19
-rw-r--r--src/core/stdchat/src/clist.cpp9
8 files changed, 20 insertions, 115 deletions
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp
index 61dfdb512b..681cd4f02a 100644
--- a/plugins/FileAsMessage/src/main.cpp
+++ b/plugins/FileAsMessage/src/main.cpp
@@ -95,12 +95,6 @@ int OnSettingChanged(WPARAM wParam,LPARAM lParam)
return 0;
}
-int OnContactAdded(WPARAM wParam,LPARAM lParam)
-{
- CallService(MS_PROTO_ADDTOCONTACT, wParam, (LPARAM)SERVICE_NAME);
- return 0;
-}
-
INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam)
{
CLISTEVENT *clev = (CLISTEVENT*)lParam;
@@ -243,25 +237,16 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
hIcons[indx] = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[indx]);
hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while(hContact)
- {
- if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)SERVICE_NAME))
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)SERVICE_NAME);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
- }
- CLISTMENUITEM mi;
- ZeroMemory(&mi, sizeof(mi));
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.cbSize = sizeof(CLISTMENUITEM);
mi.position = 200011;
mi.hIcon = hIcons[ICON_MAIN];
- mi.pszName = Translate("File As Message...");
+ mi.pszName = LPGEN("File As Message...");
mi.pszService = SERVICE_NAME "/FESendFile";
mi.pszContactOwner = NULL;
mi.flags = CMIF_NOTOFFLINE;
Menu_AddContactMenuItem(&mi);
-
return 0;
}
@@ -294,7 +279,6 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
hHookDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
- hHookContactAdded = HookEvent(ME_DB_CONTACT_ADDED, OnContactAdded);
hHookSkinIconsChanged = NULL;
return 0;
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp
index 470f4aa663..0ed0abf9c8 100644
--- a/plugins/MetaContacts/src/meta_utils.cpp
+++ b/plugins/MetaContacts/src/meta_utils.cpp
@@ -371,11 +371,6 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
return FALSE;
}
- // Add the MetaContactFilter module to the old contact to intercept messages and forward to the new
- // metacontact
- if ( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)src, ( LPARAM )META_FILTER ))
- CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)src, ( LPARAM )META_FILTER );
-
// Write the link in the contact
if (DBWriteContactSettingDword(src,META_PROTO,META_LINK,metaID)) {
MessageBox(0, Translate("Could not write MetaContact id to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
diff --git a/plugins/MirOTR/MirOTR/dllmain.cpp b/plugins/MirOTR/MirOTR/dllmain.cpp
index 4b4280638a..59841d4e1d 100644
--- a/plugins/MirOTR/MirOTR/dllmain.cpp
+++ b/plugins/MirOTR/MirOTR/dllmain.cpp
@@ -90,14 +90,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int NewContact(WPARAM wParam, LPARAM lParam) {
- // add filter
- HANDLE hContact = (HANDLE)wParam;
- CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact, ( LPARAM )MODULENAME );
-
- return 0;
-}
-
DLLFUNC int Load(void)
{
DEBUGOUT_T("LOAD MIROTR")
@@ -126,20 +118,6 @@ DLLFUNC int Load(void)
DBWriteContactSettingByte(0, MODULENAME, "FilterOrderFix", 2);
}
- // add us as a filter to all contacts
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
- char *proto;
- while ( hContact != NULL ) {
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
-
- // do not add filter to a chatoom
- if ( !(proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0)) )
- CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact, ( LPARAM )MODULENAME );
-
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
- }
- HookEvent(ME_DB_CONTACT_ADDED, NewContact);
-
// create our services
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, SVC_OTRSendMessage);
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE"W", SVC_OTRSendMessageW);
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 68cdd23d8a..c091612d24 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -165,13 +165,6 @@ extern "C" int __declspec(dllexport) Load()
return 0;
}
-int AddContact(WPARAM w, LPARAM l)
-{
- CallService(MS_PROTO_ADDTOCONTACT,w,(LPARAM)szGPGModuleName);
- return 0;
-}
-
-
static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
{
@@ -253,14 +246,6 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
CreateProtoServiceFunction(szGPGModuleName, PSS_FILE, (MIRANDASERVICE)onSendFile);
CreateProtoServiceFunction(szGPGModuleName, PSS_FILE"W", (MIRANDASERVICE)onSendFile);
-
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)szGPGModuleName))
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)szGPGModuleName);
-
- HookEvent(ME_DB_CONTACT_ADDED,AddContact);
-
-
return 0;
}
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp
index 2c32bc7169..cdffbd30c6 100644
--- a/plugins/Scriver/src/chat/clist.cpp
+++ b/plugins/Scriver/src/chat/clist.cpp
@@ -69,8 +69,6 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
END_GROUPLOOP:
DBWriteContactSettingWord(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName );
-/* if (iType != GCW_SERVER)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
return hContact;
}
@@ -78,19 +76,17 @@ END_GROUPLOOP:
if (( hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL )
return NULL;
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule);
if ( lstrlen( pszGroup ) > 0 )
DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup );
- else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ else
+ DBDeleteContactSetting(hContact, "CList", "Group");
DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName );
DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom );
- DBWriteContactSettingByte(hContact, pszModule, "ChatRoom", (BYTE)iType);
- DBWriteContactSettingWord(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
-// if (iType == GCW_SERVER)
- // DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
- return hContact;
- }
+ DBWriteContactSettingByte(hContact, pszModule, "ChatRoom", (BYTE)iType);
+ DBWriteContactSettingWord(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
+ return hContact;
+}
BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
{
@@ -98,10 +94,6 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
char * szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
-/*
- int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
- if (bHide && i != GCW_SERVER)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
return TRUE;
}
@@ -110,20 +102,15 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule)
{
- HANDLE hContact;
- char * szProto;
-
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while ( hContact ) {
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if ( MM_FindModule( szProto )) {
if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) {
int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
if ( i != 0 ) {
DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
-/* if (bHide && i == GCW_CHATROOM)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
}
}
}
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp
index 310d367e1b..d2d06c09fc 100644
--- a/plugins/SecureIM/src/svcs_menu.cpp
+++ b/plugins/SecureIM/src/svcs_menu.cpp
@@ -8,26 +8,12 @@ INT_PTR __cdecl Service_IsContactSecured(WPARAM wParam, LPARAM lParam) {
INT_PTR __cdecl Service_CreateIM(WPARAM wParam,LPARAM lParam){
- if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)wParam, (LPARAM)szModuleName))
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)wParam, (LPARAM)szModuleName);
-// WPARAM flags = 0;
-// HANDLE hMetaContact = getMetaContact((HANDLE)wParam);
-// if ( hMetaContact ) {
-// wParam = (WPARAM)hMetaContact;
-// flags = PREF_METANODB;
-// }
CallContactService((HANDLE)wParam,PSS_MESSAGE,(WPARAM)PREF_METANODB,(LPARAM)SIG_INIT);
return 1;
}
INT_PTR __cdecl Service_DisableIM(WPARAM wParam,LPARAM lParam) {
-// WPARAM flags = 0;
-// HANDLE hMetaContact = getMetaContact((HANDLE)wParam);
-// if ( hMetaContact ) {
-// wParam = (WPARAM)hMetaContact;
-// flags = PREF_METANODB;
-// }
CallContactService((HANDLE)wParam,PSS_MESSAGE,(WPARAM)PREF_METANODB,(LPARAM)SIG_DEIN);
return 1;
}
diff --git a/protocols/YAMN/services.cpp b/protocols/YAMN/services.cpp
index 229870fd62..cd01722997 100644
--- a/protocols/YAMN/services.cpp
+++ b/protocols/YAMN/services.cpp
@@ -485,13 +485,12 @@ void RefreshContact(void)
else
DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1);
}
- else {
- if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
- Finder->hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)Finder->hContact, (LPARAM)YAMN_DBMODULE);
- DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
- DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
- DBWriteContactSettingString(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
- DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
-} } } }
+ else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
+ Finder->hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)Finder->hContact, (LPARAM)YAMN_DBMODULE);
+ DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
+ DBWriteContactSettingString(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
+ DBWriteContactSettingString(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
+ DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
+ DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+} } }
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp
index df60f1de3a..aa17d09d6c 100644
--- a/src/core/stdchat/src/clist.cpp
+++ b/src/core/stdchat/src/clist.cpp
@@ -67,8 +67,6 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
END_GROUPLOOP:
DBWriteContactSettingWord( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName );
-/* if ( iType != GCW_SERVER )
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
return hContact;
}
@@ -85,8 +83,6 @@ END_GROUPLOOP:
DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom );
DBWriteContactSettingByte( hContact, pszModule, "ChatRoom", (BYTE)iType );
DBWriteContactSettingWord( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
-// if (iType == GCW_SERVER)
- // DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
return hContact;
}
@@ -97,8 +93,6 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
-/* if ( bHide && i != GCW_SERVER )
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
return TRUE;
}
@@ -119,8 +113,6 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule)
if ( i != 0 ) {
DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- /*0000if (bHide && i == GCW_CHATROOM)d0
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);*/
} } }
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
@@ -261,7 +253,6 @@ void CList_CreateGroup(TCHAR* group)
DBFreeVariant(&dbv);
}
- // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0);
name[0] = 1 | GROUPF_EXPANDED;
_tcsncpy(name + 1, group, SIZEOF(name) - 1);
name[ lstrlen(group) + 1] = '\0';