diff options
author | Szymon Tokarz <wsx22@o2.pl> | 2012-11-25 00:29:44 +0000 |
---|---|---|
committer | Szymon Tokarz <wsx22@o2.pl> | 2012-11-25 00:29:44 +0000 |
commit | 211bbf191607dd8753709a30925cfd7a82149259 (patch) | |
tree | 69539f4c14cc52b4b26e7c99c542be619791169b /protocols | |
parent | ee9f17df8cbd7708ba6ba822243448504a6e8dfa (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')
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 74 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 15 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/version.h | 6 |
3 files changed, 41 insertions, 54 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);
}
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index c75f3e70ac..541b4832a6 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -64,13 +64,6 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) setalloffline();
db_set_dw(NULL, m_szModuleName, GG_KEY_LOGONTIME, 0);
- DWORD dwVersion;
- if ((dwVersion = db_get_dw(NULL, m_szModuleName, GG_PLUGINVERSION, 0)) < pluginInfo.version)
- cleanuplastplugin(dwVersion);
-
- links_instance_init();
- initavatarrequestthread();
-
TCHAR szPath[MAX_PATH];
TCHAR *tmpPath = Utils_ReplaceVarsT( _T("%miranda_avatarcache%"));
mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s"), tmpPath, m_tszUserName);
@@ -81,6 +74,14 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), tmpPath, m_tszUserName);
mir_free(tmpPath);
hImagesFolder = FoldersRegisterCustomPathT(m_szModuleName, "Images", szPath);
+
+ DWORD dwVersion;
+ if ((dwVersion = db_get_dw(NULL, m_szModuleName, GG_PLUGINVERSION, 0)) < pluginInfo.version)
+ cleanuplastplugin(dwVersion);
+
+ links_instance_init();
+ initavatarrequestthread();
+
}
GGPROTO::~GGPROTO()
diff --git a/protocols/Gadu-Gadu/src/version.h b/protocols/Gadu-Gadu/src/version.h index ce9e719bd6..b904ca056b 100644 --- a/protocols/Gadu-Gadu/src/version.h +++ b/protocols/Gadu-Gadu/src/version.h @@ -18,6 +18,6 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
////////////////////////////////////////////////////////////////////////////////
-#define __FILEVERSION_STRING 0,11,0,1
-#define __VERSION_STRING "0.11.0.1"
-#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 11, 0, 1)
+#define __FILEVERSION_STRING 0,11,0,2
+#define __VERSION_STRING "0.11.0.2"
+#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 11, 0, 2)
|