summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/gg.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-11-25 00:29:44 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-11-25 00:29:44 +0000
commit211bbf191607dd8753709a30925cfd7a82149259 (patch)
tree69539f4c14cc52b4b26e7c99c542be619791169b /protocols/Gadu-Gadu/src/gg.cpp
parentee9f17df8cbd7708ba6ba822243448504a6e8dfa (diff)
Gadu-Gadu protocol
- implemented single junk files cleaning from avatar cache folder created after last avatar api change issue - cleaning code in gg.cpp cleanuplastplugin() that is not needed in NG - bump version to 0.11.0.2 git-svn-id: http://svn.miranda-ng.org/main/trunk@2473 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/gg.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp74
1 files changed, 30 insertions, 44 deletions
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 81c95658d6..eafcb952fa 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -147,56 +147,42 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO
void GGPROTO::cleanuplastplugin(DWORD version)
{
- HANDLE hContact;
- char *szProto;
- // Remove bad e-mail and phones from
- if (version < PLUGIN_MAKE_VERSION(0, 0, 1, 4))
- {
-#ifdef DEBUGMODE
- netlog("cleanuplastplugin() version=%d Cleaning junk Phone settings from < 0.0.1.4 ...", version);
-#endif
- // Look for contact in DB
- hContact = db_find_first();
- while (hContact)
- {
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto != NULL && !strcmp(szProto, m_szModuleName))
- {
- // Do contact cleanup
- db_unset(hContact, m_szModuleName, GG_KEY_EMAIL);
- db_unset(hContact, m_szModuleName, "Phone");
- }
- hContact = db_find_next(hContact);
- }
- }
+ // Store current plugin version
+ db_set_dw(NULL, m_szModuleName, GG_PLUGINVERSION, pluginInfo.version);
- // Remove GG entries for non GG contacts
- if (version < PLUGIN_MAKE_VERSION(0, 0, 3, 5))
- {
-#ifdef DEBUGMODE
- netlog("cleanuplastplugin(): version=%d Cleaning junk Nick settings from < 0.0.3.5 ...", version);
-#endif
- // Look for contact in DB
- hContact = db_find_first();
- while (hContact)
- {
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto != NULL && strcmp(szProto, m_szModuleName))
- {
- // Do nick entry cleanup
- db_unset(hContact, m_szModuleName, GG_KEY_NICK);
+
+ //1. clean files: %miranda_avatarcache%\GG\*.(null)
+ if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
+ netlog("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
+
+ TCHAR avatarsPath[MAX_PATH];
+ if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, avatarsPath, MAX_PATH, _T(""))) {
+ mir_ptr<TCHAR> tmpPath( Utils_ReplaceVarsT( _T("%miranda_avatarcache%")));
+ mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)tmpPath, m_tszUserName);
+ }
+ netlog("cleanuplastplugin() 1: miranda_avatarcache = %S", avatarsPath);
+
+ if (avatarsPath != NULL){
+ HANDLE hFind = INVALID_HANDLE_VALUE;
+ TCHAR spec[MAX_PATH + 10];
+ mir_sntprintf(spec, MAX_PATH + 10, _T("%s\\*.(null)"), avatarsPath);
+ WIN32_FIND_DATA ffd;
+ hFind = FindFirstFile(spec, &ffd);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ TCHAR filePathT [2*MAX_PATH + 10];
+ mir_sntprintf(filePathT, 2*MAX_PATH + 10, _T("%s\\%s"), avatarsPath, ffd.cFileName);
+ if (!_taccess(filePathT, 0)){
+ netlog("cleanuplastplugin() 1: remove file = %S", filePathT);
+ _tremove(filePathT);
+ }
+ } while (FindNextFile(hFind, &ffd) != 0);
+ FindClose(hFind);
}
- hContact = db_find_next(hContact);
}
}
- // Remove old unneeded entry
- if (version < PLUGIN_MAKE_VERSION(0, 0, 5, 3))
- db_unset(NULL, m_szModuleName, "ShowNotOnMyList");
-
- // Store this plugin version
- db_set_dw(NULL, m_szModuleName, GG_PLUGINVERSION, pluginInfo.version);
}
//////////////////////////////////////////////////////////