From 71eabf9174e4829e85d84f1098ef0d70b3674300 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Mar 2013 12:02:34 +0000 Subject: - avatars' Folders settings moved to the "Avatars" section; - TCHAR_STR_PARAM is replaced by %S (we don't need the ansi version) git-svn-id: http://svn.miranda-ng.org/main/trunk@3830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FlashAvatars/src/cflash.cpp | 2 +- protocols/AimOscar/src/avatars.cpp | 16 +++---- protocols/FacebookRM/src/proto.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 2 +- protocols/JabberG/src/jabber_byte.cpp | 2 +- protocols/JabberG/src/jabber_caps.cpp | 6 +-- protocols/JabberG/src/jabber_events.cpp | 6 +-- protocols/JabberG/src/jabber_icolib.cpp | 2 +- protocols/JabberG/src/jabber_iq.cpp | 4 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 4 +- protocols/JabberG/src/jabber_iqid.cpp | 18 ++++---- protocols/JabberG/src/jabber_message_manager.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 37 +++++++---------- protocols/JabberG/src/jabber_password.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 10 ++--- protocols/JabberG/src/jabber_proto.h | 3 ++ protocols/JabberG/src/jabber_secur.cpp | 2 +- protocols/JabberG/src/jabber_svc.cpp | 2 +- protocols/JabberG/src/jabber_thread.cpp | 26 ++++++------ protocols/JabberG/src/jabber_userinfo.cpp | 2 +- protocols/JabberG/src/jabber_vcard.cpp | 10 ++--- protocols/MRA/src/MraAvatars.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 2 +- protocols/Skype/src/skype_proto.h | 4 +- protocols/Skype/src/skype_utils.cpp | 53 +++++++++++------------- protocols/Twitter/src/proto.cpp | 2 +- protocols/Yahoo/src/avatar.cpp | 2 +- 28 files changed, 111 insertions(+), 116 deletions(-) diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index f571a4ac7c..543ec53e71 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -605,7 +605,7 @@ static int systemModulesLoaded(WPARAM /*wParam*/, LPARAM /*lParam*/) // default for older Mirandas else PathToAbsoluteT( _T("Flash\\"), path); - hAvatarsFolder = FoldersRegisterCustomPathT("Flash Avatars", "Avatars Cache", path); + hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", "Flash Avatars", path); return 0; } diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index a2277658de..91b5ccec23 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -98,10 +98,10 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const AI.cbSize = sizeof(AI); AI.hContact = contact_from_sn(sn); - + if (data_len > 0) { - const TCHAR *type; + const TCHAR *type; AI.format = detect_image_type(data, type); get_avatar_filename(AI.hContact, AI.filename, SIZEOF(AI.filename), type); @@ -153,7 +153,7 @@ int detect_image_type(const char* stream, const TCHAR* &type_ret) int detect_image_type(const TCHAR* file) { const TCHAR *ext = _tcsrchr(file, '.'); - if (ext == NULL) + if (ext == NULL) return PA_FORMAT_UNKNOWN; if (_tcsicmp(ext, _T(".gif")) == 0) return PA_FORMAT_GIF; @@ -167,13 +167,13 @@ int detect_image_type(const TCHAR* file) void CAimProto::init_custom_folders(void) { - if (init_cst_fld_ran) return; + if (init_cst_fld_ran) return; TCHAR AvatarsFolder[MAX_PATH]; TCHAR *tszModuleName = mir_a2t(m_szModuleName); mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%s"), tszModuleName); - hAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder); + hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder); mir_free(tszModuleName); init_cst_fld_ran = true; @@ -195,7 +195,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen mir_free(tszModuleName); mir_free(tmpPath); } - else + else { _tcscpy(pszDest, path); tPathLen = _tcslen(pszDest); @@ -205,7 +205,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen CreateDirectoryTreeT(pszDest); size_t tPathLen2 = tPathLen; - + DBVARIANT dbv; if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR; tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal); @@ -228,7 +228,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen } while (_tfindnext(hFile, &c_file) == 0); _findclose( hFile ); } - + if (!found) pszDest[0] = 0; } else diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 3379aed18f..776fe875fc 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -71,7 +71,7 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) SkinAddNewSoundExT( "OtherEvent", m_tszUserName, LPGENT( "Other Event" )); def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName; - hAvatarFolder_ = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", def_avatar_folder_.c_str()); + hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_tszUserName, def_avatar_folder_.c_str()); // Set all contacts offline -- in case we crashed SetAllContactStatuses( ID_STATUS_OFFLINE, true ); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 8428c98967..35e5159510 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -67,7 +67,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) TCHAR szPath[MAX_PATH]; mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName); - hAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", szPath); + hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, szPath); mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(m_szModuleName, "Images", szPath); diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index b7ab99aac3..53f7ee59c4 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -93,7 +93,7 @@ void CIcqProto::InitAvatars() // check if it does make sense TCHAR tszPath[MAX_PATH * 2]; null_snprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM) _T("\\"), m_szModuleName); - hAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars Cache", tszPath); + hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, tszPath); } diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index dc1e7f2c08..2f795f0872 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -641,7 +641,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) if (jbt->streamhostJID) mir_free(jbt->streamhostJID); jbt->streamhostJID = mir_tstrdup(str); - Log("bytestream_recv connecting to " TCHAR_STR_PARAM ":%d", szHost, port); + Log("bytestream_recv connecting to %S:%d", szHost, port); NETLIBOPENCONNECTION nloc = { 0 }; nloc.cbSize = sizeof(nloc); nloc.szHost = mir_t2a(szHost); diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index ac1399cf9a..62de2039b7 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -575,12 +575,12 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szV CJabberClientCaps *pClient = FindClient(szNode); if ( !pClient) { Unlock(); - ppro->Log("CAPS: get no caps for: " TCHAR_STR_PARAM ", " TCHAR_STR_PARAM, szNode, szVer); + ppro->Log("CAPS: get no caps for: %S, %S", szNode, szVer); return JABBER_RESOURCE_CAPS_UNINIT; } JabberCapsBits jcbCaps = pClient->GetPartialCaps(szVer); Unlock(); - ppro->Log("CAPS: get caps %I64x for: " TCHAR_STR_PARAM ", " TCHAR_STR_PARAM, jcbCaps, szNode, szVer); + ppro->Log("CAPS: get caps %I64x for: %S, %S", jcbCaps, szNode, szVer); return jcbCaps; } @@ -599,7 +599,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *s } BOOL bOk = pClient->SetPartialCaps(szVer, jcbCaps, nIqId); Unlock(); - ppro->Log("CAPS: set caps %I64x for: " TCHAR_STR_PARAM ", " TCHAR_STR_PARAM, jcbCaps, szNode, szVer); + ppro->Log("CAPS: set caps %I64x for: %S, %S", jcbCaps, szNode, szVer); return bOk; } diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 290b756e71..32e71215ea 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -117,7 +117,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon else { TCHAR* p = sttSettingToTchar(cws); if (cws->value.pszVal != NULL && lstrcmp(p, item->group)) { - Log("Group set to " TCHAR_STR_PARAM, p); + Log("Group set to %S", p); if (p) AddContactToRoster(item->jid, nick, p); } @@ -147,7 +147,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hC TCHAR* newNick = sttSettingToTchar(cws); if (newNick) { if (lstrcmp(item->nick, newNick)) { - Log("Renaming contact " TCHAR_STR_PARAM ": " TCHAR_STR_PARAM " -> " TCHAR_STR_PARAM, item->jid, item->nick, newNick); + Log("Renaming contact %S: %S -> %S", item->jid, item->nick, newNick); AddContactToRoster(item->jid, newNick, item->group); } mir_free(newNick); @@ -163,7 +163,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL return; TCHAR *nick; - Log("Add " TCHAR_STR_PARAM " permanently to list", jid.pszVal); + Log("Add %S permanently to list", jid.pszVal); if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv)) { nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 57ae08257b..b6d2525fcf 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -325,7 +325,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) int first=-1; HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102)); - mir_sntprintf(Group, SIZEOF(Group), _T("Status Icons/%s/") _T(TCHAR_STR_PARAM) _T(" %s"), m_tszUserName, proto, TranslateT("transport")); + mir_sntprintf(Group, SIZEOF(Group), _T("Status Icons/%s/%S %s"), m_tszUserName, proto, TranslateT("transport")); mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto); if ( !hAdvancedStatusIcon) hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index a92ba930fe..6be5980c54 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -232,7 +232,7 @@ void CJabberIqManager::ExpireInfo(CJabberIqInfo* pInfo, void*) if ((pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (pInfo->m_szFrom)) pInfo->m_hContact = ppro->HContactFromJID(pInfo->m_szFrom , 3); - ppro->Log("Expiring iq id %d, sent to " TCHAR_STR_PARAM, pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : _T("server")); + ppro->Log("Expiring iq id %d, sent to %S", pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : _T("server")); pInfo->m_nIqType = JABBER_IQ_TYPE_FAIL; (ppro->*(pInfo->m_pHandler))(NULL, pInfo); @@ -360,7 +360,7 @@ BOOL CJabberIqManager::HandleIqPermanent(HXML pNode) if ((pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (iqInfo.m_szFrom)) iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom, 3); - ppro->Log("Handling iq id " TCHAR_STR_PARAM ", type " TCHAR_STR_PARAM ", from " TCHAR_STR_PARAM, iqInfo.m_szId, szType, iqInfo.m_szFrom); + ppro->Log("Handling iq id %S, type %S, from %S", iqInfo.m_szId, szType, iqInfo.m_szFrom); if ((ppro->*(pInfo->m_pHandler))(pNode, &iqInfo)) { bStopHandling = TRUE; break; diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 459f917fbe..5868e93f82 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -555,7 +555,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // invalid JID if ( !bRetVal) { - Log(" attempt to hack via roster push from " TCHAR_STR_PARAM, pInfo->GetFrom()); + Log(" attempt to hack via roster push from %S", pInfo->GetFrom()); return TRUE; } } @@ -631,7 +631,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) else if ( !_tcscmp(str, _T("to"))) item->subscription = SUB_TO; else if ( !_tcscmp(str, _T("from"))) item->subscription = SUB_FROM; else item->subscription = SUB_NONE; - Log("Roster push for jid=" TCHAR_STR_PARAM ", set subscription to " TCHAR_STR_PARAM, jid, str); + Log("Roster push for jid=%S, set subscription to %S", jid, str); // subscription = remove is to remove from roster list // but we will just set the contact to offline and not actually // remove, so that history will be retained. diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 628c9018d0..56f181e658 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -308,9 +308,9 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo* pInfo) LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid"); if (szJid) { if ( !_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID))) - Log("Result Bind: " TCHAR_STR_PARAM " confirmed ", m_ThreadInfo->fullJID); + Log("Result Bind: %S confirmed ", m_ThreadInfo->fullJID); else { - Log("Result Bind: " TCHAR_STR_PARAM " changed to " TCHAR_STR_PARAM, m_ThreadInfo->fullJID, szJid); + Log("Result Bind: %S changed to %S", m_ThreadInfo->fullJID, szJid); _tcsncpy(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)); } } @@ -542,7 +542,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) DBVARIANT dbv; if ( !JGetStringT(hContact, "jid", &dbv)) { if ( !ListExist(LIST_ROSTER, dbv.ptszVal)) { - Log("Syncing roster: preparing to delete " TCHAR_STR_PARAM " (hContact=0x%x)", dbv.ptszVal, hContact); + Log("Syncing roster: preparing to delete %S (hContact=0x%x)", dbv.ptszVal, hContact); if (listSize >= listAllocSize) { listAllocSize = listSize + 100; if ((list=(HANDLE *) mir_realloc(list, listAllocSize * sizeof(HANDLE))) == NULL) { @@ -688,7 +688,7 @@ LBL_Ret: TCHAR szAvatarFileName[MAX_PATH]; GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName)); - Log("Picture file name set to " TCHAR_STR_PARAM, szAvatarFileName); + Log("Picture file name set to %S", szAvatarFileName); HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) goto LBL_Ret; @@ -705,7 +705,7 @@ LBL_Ret: hasPhoto = TRUE; CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)szAvatarFileName); - Log("My picture saved to " TCHAR_STR_PARAM, szAvatarFileName); + Log("My picture saved to %S", szAvatarFileName); } else { DBVARIANT dbv; @@ -720,7 +720,7 @@ LBL_Ret: if (item->photoFileName && _tcscmp(item->photoFileName, szAvatarFileName)) DeleteFile(item->photoFileName); replaceStrT(item->photoFileName, szAvatarFileName); - Log("Contact's picture saved to " TCHAR_STR_PARAM, szAvatarFileName); + Log("Contact's picture saved to %S", szAvatarFileName); OnIqResultGotAvatar(hContact, o, xmlGetText(m)); } @@ -1254,7 +1254,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode) _tcsncpy(jsr.jid, jid, SIZEOF(jsr.jid)); jsr.jid[ SIZEOF(jsr.jid)-1] = '\0'; jsr.hdr.id = (TCHAR*)jid; - Log("Result jid = " TCHAR_STR_PARAM, jid); + Log("Result jid = %S", jid); if ((n=xmlGetChild(itemNode , "nick"))!=NULL && xmlGetText(n)!=NULL) jsr.hdr.nick = (TCHAR*)xmlGetText(n); else @@ -1325,7 +1325,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode) if ( !lstrcmp(fieldName, _T("jid"))) { _tcsncpy(jsr.jid, xmlGetText(n), SIZEOF(jsr.jid)); jsr.jid[SIZEOF(jsr.jid)-1] = '\0'; - Log("Result jid = " TCHAR_STR_PARAM, jsr.jid); + Log("Result jid = %S", jsr.jid); } else if ( !lstrcmp(fieldName, _T("nickname"))) jsr.hdr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T(""); @@ -1523,7 +1523,7 @@ void CJabberProto::OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mim else if ( !lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP; else { LBL_ErrFormat: - Log("Invalid mime type specified for picture: " TCHAR_STR_PARAM, mimeType); + Log("Invalid mime type specified for picture: %S", mimeType); mir_free(body); return; } } diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index 2f7b6ab035..f260004f87 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -92,7 +92,7 @@ BOOL CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea messageInfo.m_hContact = ppro->HContactFromJID(messageInfo.m_szFrom, 3); if (messageInfo.m_szFrom) - ppro->Log("Handling message from " TCHAR_STR_PARAM, messageInfo.m_szFrom); + ppro->Log("Handling message from %S", messageInfo.m_szFrom); if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &messageInfo)) { bStopHandling = TRUE; break; diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index ce13696af7..f2b4b12c42 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -202,7 +202,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t db_set_b(hContact, "CList", "NotOnList", 1); else SendGetVcard(s); - Log("Create Jabber contact jid=" TCHAR_STR_PARAM ", nick=" TCHAR_STR_PARAM, s, nick); + Log("Create Jabber contact jid=%S, nick=%S", s, nick); DBCheckIsTransportedContact(s,hContact); } @@ -246,18 +246,15 @@ BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType) /////////////////////////////////////////////////////////////////////////////// // JabberGetAvatarFileName() - gets a file name for the avatar image -static HANDLE hJabberAvatarsFolder = NULL; -static bool bInitDone = false; - void CJabberProto::InitCustomFolders(void) { - if (bInitDone) + if (m_bFoldersInitDone) return; - bInitDone = true; + m_bFoldersInitDone = true; TCHAR AvatarsFolder[MAX_PATH]; - mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\Jabber")); - hJabberAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder); + mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName); + m_hJabberAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder); } void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen) @@ -267,12 +264,10 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL InitCustomFolders(); - if (hJabberAvatarsFolder == NULL || FoldersGetCustomPathT(hJabberAvatarsFolder, path, (int)cbLen, _T(""))) { - TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_avatarcache%")); - tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\Jabber"), tmpPath); - mir_free(tmpPath); - } - else tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s"), path); + if (m_hJabberAvatarsFolder == NULL || FoldersGetCustomPathT(m_hJabberAvatarsFolder, path, (int)cbLen, _T(""))) + tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), (TCHAR*)VARST(_T("%miranda_avatarcache%")), m_szModuleName); + else + tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s"), path); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -299,18 +294,18 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL else _i64toa((LONG_PTR)hContact, str, 10); char* hash = JabberSha1(str); - mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T(TCHAR_STR_PARAM) _T(".") _T(TCHAR_STR_PARAM), hash, szFileType); + mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S.%S"), hash, szFileType); mir_free(hash); } else if (m_ThreadInfo != NULL) { - mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%s@") _T(TCHAR_STR_PARAM) _T(" avatar.") _T(TCHAR_STR_PARAM), + mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%s@%S avatar.%S"), m_ThreadInfo->username, m_ThreadInfo->server, szFileType); } else { DBVARIANT dbv1, dbv2; BOOL res1 = DBGetContactSettingString(NULL, m_szModuleName, "LoginName", &dbv1); BOOL res2 = DBGetContactSettingString(NULL, m_szModuleName, "LoginServer", &dbv2); - mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T(TCHAR_STR_PARAM) _T("@") _T(TCHAR_STR_PARAM) _T(" avatar.") _T(TCHAR_STR_PARAM), + mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S@%S avatar.%S"), res1 ? "noname" : dbv1.pszVal, res2 ? m_szModuleName : dbv2.pszVal, szFileType); @@ -463,7 +458,7 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item) if ( !hContact) return; - Log("JabberUpdateMirVer: for jid " TCHAR_STR_PARAM, item->jid); + Log("JabberUpdateMirVer: for jid %S", item->jid); int resource = -1; if (item->resourceMode == RSMODE_LASTSEEN) @@ -484,7 +479,7 @@ void CJabberProto::FormatMirVer(JABBER_RESOURCE_STATUS *resource, TCHAR *buf, in // jabber:iq:version info requested and exists? if (resource->dwVersionRequestTime && resource->software) { - Log("JabberUpdateMirVer: for iq:version rc " TCHAR_STR_PARAM ": " TCHAR_STR_PARAM, resource->resourceName, resource->software); + Log("JabberUpdateMirVer: for iq:version rc %S: %S", resource->resourceName, resource->software); if ( !resource->version || _tcsstr(resource->software, resource->version)) lstrcpyn(buf, resource->software, bufSize); else @@ -492,13 +487,13 @@ void CJabberProto::FormatMirVer(JABBER_RESOURCE_STATUS *resource, TCHAR *buf, in } // no version info and no caps info? set MirVer = resource name else if ( !resource->szCapsNode || !resource->szCapsVer) { - Log("JabberUpdateMirVer: for rc " TCHAR_STR_PARAM ": " TCHAR_STR_PARAM, resource->resourceName, resource->resourceName); + Log("JabberUpdateMirVer: for rc %S: %S", resource->resourceName, resource->resourceName); if (resource->resourceName) lstrcpyn(buf, resource->resourceName, bufSize); } // XEP-0115 caps mode else { - Log("JabberUpdateMirVer: for rc " TCHAR_STR_PARAM ": " TCHAR_STR_PARAM "#" TCHAR_STR_PARAM, resource->resourceName, resource->szCapsNode, resource->szCapsVer); + Log("JabberUpdateMirVer: for rc %S: %S#%S", resource->resourceName, resource->szCapsNode, resource->szCapsVer); int i; diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 341788cf29..e0da9c6fd3 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -49,7 +49,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR TranslateDialogDefault(hwndDlg); if (ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL) { TCHAR text[1024]; - mir_sntprintf(text, SIZEOF(text), _T("%s %s@") _T(TCHAR_STR_PARAM), TranslateT("Set New Password for"), ppro->m_ThreadInfo->username, ppro->m_ThreadInfo->server); + mir_sntprintf(text, SIZEOF(text), _T("%s %s@%S"), TranslateT("Set New Password for"), ppro->m_ThreadInfo->username, ppro->m_ThreadInfo->server); SetWindowText(hwndDlg, text); } return TRUE; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 7eeeb47a52..eb81e2002a 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -360,12 +360,12 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) HANDLE hContact; TCHAR* jid, *nick; - Log("AddToListByJID jid = " TCHAR_STR_PARAM, newJid); + Log("AddToListByJID jid = %S", newJid); if ((hContact=HContactFromJID(newJid)) == NULL) { // not already there: add jid = mir_tstrdup(newJid); - Log("Add new jid to contact jid = " TCHAR_STR_PARAM, jid); + Log("Add new jid to contact jid = %S", jid); hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); JSetStringT(hContact, "jid", jid); @@ -473,7 +473,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent) char *lastName = firstName + strlen(firstName) + 1; char *jid = lastName + strlen(lastName) + 1; - Log("Send 'authorization allowed' to " TCHAR_STR_PARAM, jid); + Log("Send 'authorization allowed' to %S", jid); TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); @@ -485,7 +485,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent) JABBER_LIST_ITEM *item; if ((item = ListGetItemPtr(LIST_ROSTER, newJid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { - Log("Try adding contact automatically jid = " TCHAR_STR_PARAM, jid); + Log("Try adding contact automatically jid = %S", jid); if ((hContact = AddToListByJID(newJid, 0)) != NULL) { // Trigger actual add by removing the "NotOnList" added by AddToListByJID() // See AddToListByJID() and JabberDbSettingChanged(). @@ -1417,7 +1417,7 @@ int __cdecl CJabberProto::SendAwayMsg(HANDLE /*hContact*/, HANDLE /*hProcess*/, int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg) { - Log("SetAwayMsg called, wParam=%d lParam=" TCHAR_STR_PARAM, status, msg); + Log("SetAwayMsg called, wParam=%d lParam=%S", status, msg); EnterCriticalSection(&m_csModeMsgMutex); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 09a037573c..f37f1f264d 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -991,6 +991,9 @@ private: DWORD m_lastTicks; + HANDLE m_hJabberAvatarsFolder; + BOOL m_bFoldersInitDone; + CRITICAL_SECTION m_csSerial; unsigned int m_nSerial; diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index e15e7eb1a9..eaf8076f2d 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -109,7 +109,7 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) mir_free(connectHostT); } - Netlib_Logf(NULL, "SPN: " TCHAR_STR_PARAM, szSpn); + Netlib_Logf(NULL, "SPN: %S", szSpn); return true; diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index b9bde4c8bb..af28a302d2 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -164,7 +164,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) } else lstrcpyn(szJid, dbv.ptszVal, SIZEOF(szJid)); - Log("Rereading %s for " TCHAR_STR_PARAM, isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid); + Log("Rereading %s for %S", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid); int iqId = SerialNext(); if (isXVcard) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index bea9519b96..eb0e65926f 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -339,7 +339,7 @@ LBL_FatalError: } TCHAR jidStr[512]; - mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@") _T(TCHAR_STR_PARAM) _T("/%s"), info->username, info->server, info->resource); + mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S/%s"), info->username, info->server, info->resource); _tcsncpy(info->fullJID, jidStr, SIZEOF(info->fullJID)-1); if (m_options.SavePassword == FALSE) { @@ -348,7 +348,7 @@ LBL_FatalError: info->password[ SIZEOF(info->password)-1] = '\0'; } else { - mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@") _T(TCHAR_STR_PARAM), info->username, info->server); + mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S"), info->username, info->server); JabberPasswordDlgParam param; param.pro = this; @@ -459,7 +459,7 @@ LBL_FatalError: m_bJabberConnected = TRUE; size_t len = _tcslen(info->username) + strlen(info->server)+1; m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1)); - mir_sntprintf(m_szJabberJID, len+1, _T("%s@") _T(TCHAR_STR_PARAM), info->username, info->server); + mir_sntprintf(m_szJabberJID, len+1, _T("%s@%S"), info->username, info->server); m_bSendKeepAlive = m_options.KeepAlive != 0; JSetStringT(NULL, "jid", m_szJabberJID); // store jid in database } @@ -744,7 +744,7 @@ void CJabberProto::PerformAuthentication(ThreadData* info) } TCHAR text[1024]; - mir_sntprintf(text, SIZEOF(text), _T("%s %s@")_T(TCHAR_STR_PARAM)_T("."), TranslateT("Authentication failed for"), info->username, info->server); + mir_sntprintf(text, SIZEOF(text), _T("%s %s@%S."), TranslateT("Authentication failed for"), info->username, info->server); MsgPopup(NULL, text, TranslateT("Jabber Authentication")); JSendBroadcast(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD); info->send(""); @@ -928,7 +928,7 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info) db_free(&dbv); xmlStreamInitialize("after successful sasl"); } - else Log("Success: unknown action "TCHAR_STR_PARAM".",type); + else Log("Success: unknown action %S.",type); } void CJabberProto::OnProcessChallenge(HXML node, ThreadData* info) @@ -1516,7 +1516,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return; - Log("presence: for jid " TCHAR_STR_PARAM, from); + Log("presence: for jid %S", from); JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID(from); if (r == NULL) return; @@ -1579,7 +1579,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) } item->itemResource.status = status; if (nSelectedResource != -1) { - Log("JabberUpdateJidDbSettings: updating jid " TCHAR_STR_PARAM " to rc " TCHAR_STR_PARAM, item->jid, item->resource[nSelectedResource].resourceName); + Log("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, item->resource[nSelectedResource].resourceName); if (item->resource[nSelectedResource].statusMessage) db_set_ts(hContact, "CList", "StatusMsg", item->resource[nSelectedResource].statusMessage); else @@ -1638,14 +1638,14 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if ((hContact = HContactFromJID(from)) == NULL) { if ( !_tcsicmp(info->fullJID, from) || (!bSelfPresence && !ListExist(LIST_ROSTER, from))) { - Log("SKIP Receive presence online from "TCHAR_STR_PARAM" (who is not in my roster and not in list - skiping)", from); + Log("SKIP Receive presence online from %S (who is not in my roster and not in list - skiping)", from); mir_free(nick); return; } hContact = DBCreateContact(from, nick, TRUE, TRUE); } if ( !ListExist(LIST_ROSTER, from)) { - Log("Receive presence online from "TCHAR_STR_PARAM" (who is not in my roster)", from); + Log("Receive presence online from %S (who is not in my roster)", from); ListAdd(LIST_ROSTER, from); } DBCheckIsTransportedContact(from, hContact); @@ -1677,7 +1677,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if (_tcschr(from, '@')==NULL) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } - Log(TCHAR_STR_PARAM " (" TCHAR_STR_PARAM ") online, set contact status to %s", nick, from, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)status,0)); + Log("%S (%S) online, set contact status to %s", nick, from, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)status,0)); mir_free(nick); HXML xNode; @@ -1762,7 +1762,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) replaceStrT(item->itemResource.statusMessage, NULL); } } - else Log("SKIP Receive presence offline from " TCHAR_STR_PARAM " (who is not in my roster)", from); + else Log("SKIP Receive presence offline from %S (who is not in my roster)", from); UpdateJidDbSettings(from); @@ -1784,7 +1784,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if (m_options.AutoAdd == TRUE) { if ((item = ListGetItemPtr(LIST_ROSTER, from)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { - Log("Try adding contact automatically jid = " TCHAR_STR_PARAM, from); + Log("Try adding contact automatically jid = %S", from); if ((hContact=AddToListByJID(from, 0)) != NULL) { // Trigger actual add by removing the "NotOnList" added by AddToListByJID() // See AddToListByJID() and JabberDbSettingChanged(). @@ -1796,7 +1796,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) HXML n = xmlGetChild(node , "nick"); nick = (n == NULL) ? JabberNickFromJID(from) : mir_tstrdup(xmlGetText(n)); if (nick != NULL) { - Log(TCHAR_STR_PARAM " (" TCHAR_STR_PARAM ") requests authorization", nick, from); + Log("%S (%S) requests authorization", nick, from); DBAddAuthRequest(from, nick); mir_free(nick); } } diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 2e1a142191..ac7a4e0e79 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -660,7 +660,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid); if (item != NULL) { if (item->photoFileName) { - photoInfo->ppro->Log("Showing picture from " TCHAR_STR_PARAM, item->photoFileName); + photoInfo->ppro->Log("Showing picture from %S", item->photoFileName); char* p = mir_t2a(item->photoFileName); photoInfo->hBitmap = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p); mir_free(p); diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 4835b87245..ed7adff6f9 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -298,7 +298,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0) _tcscpy(szTempPath, _T(".\\")); if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) { - dat->ppro->Log("Temp file = " TCHAR_STR_PARAM, szTempFileName); + dat->ppro->Log("Temp file = %S", szTempFileName); if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) { char* p = mir_t2a(szTempFileName); if ((dat->hBitmap=(HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p)) != NULL) { @@ -343,7 +343,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR struct _stat st; HBITMAP hNewBitmap; - dat->ppro->Log("File selected is " TCHAR_STR_PARAM, szFileName); + dat->ppro->Log("File selected is %S", szFileName); if (_tstat(szFileName, &st)<0 || st.st_size>40*1024) { MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK|MB_SETFOREGROUND); break; @@ -351,7 +351,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0) _tcscpy(szTempPath, _T(".\\")); if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) { - dat->ppro->Log("Temp file = " TCHAR_STR_PARAM, szTempFileName); + dat->ppro->Log("Temp file = %S", szTempFileName); if (CopyFile(szFileName, szTempFileName, FALSE) == TRUE) { char* pszTemp = mir_t2a(szTempFileName); if ((hNewBitmap=(HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)pszTemp)) != NULL) { @@ -1136,7 +1136,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) szFileName = szAvatarName; // Set photo element, also update the global jabberVcardPhotoFileName to reflect the update - Log("Before update, file name = " TCHAR_STR_PARAM, szFileName); + Log("Before update, file name = %S", szFileName); if (szFileName == NULL || szFileName[0] == 0) { v << XCHILD(_T("PHOTO")); DeleteFile(szAvatarName); @@ -1149,7 +1149,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) char* buffer, *str; DWORD nRead; - Log("Saving picture from " TCHAR_STR_PARAM, szFileName); + Log("Saving picture from %S", szFileName); if (_tstat(szFileName, &st) >= 0) { // Note the FILE_SHARE_READ attribute so that the CopyFile can succeed if ((hFile=CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE) { diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 0a5d5e48fb..bf287cea67 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -90,7 +90,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) if (pmraaqAvatarsQueue->hNetlibUser) { TCHAR tszPath[ MAX_PATH ]; mir_sntprintf( tszPath, SIZEOF(tszPath), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName); - pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT(MRA_AVT_SECT_NAME, "AvatarsPath", tszPath); + pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT("Avatars", m_tszUserName, tszPath); InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE); pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL); diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 68c488fd9f..feaea0851c 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -142,7 +142,7 @@ void CMsnProto::InitCustomFolders(void) TCHAR *tszModuleName = mir_a2t(m_szModuleName); mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_userdata%%\\Avatars\\%s"), tszModuleName); - hMSNAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", folder); + hMSNAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_tszUserName, folder); mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_userdata%%\\Avatars\\%s"), tszModuleName); hCustomSmileyFolder = FoldersRegisterCustomPathT(m_szModuleName, "Custom Smiley", folder); diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 5caf605240..18c18dfeb4 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -381,6 +381,9 @@ protected: static void FakeAsync(void*); void InitCustomFolders(); + HANDLE m_hAvatarsFolder; + bool m_bInitDone; + static int DetectAvatarFormatBuffer(const char *pBuffer); static int DetectAvatarFormat(const wchar_t *path); @@ -396,7 +399,6 @@ protected: int SkypeToMirandaStatus(CContact::AVAILABILITY availability); CContact::AVAILABILITY MirandaToSkypeStatus(int status); - // runtime void InitSkype(); void UninitSkype(); diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 9ce2b8fa10..ed8f920abc 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -1,6 +1,6 @@ #include "skype_proto.h" -wchar_t* CSkypeProto::LogoutReasons[] = +wchar_t* CSkypeProto::LogoutReasons[] = { LPGENW("LOGOUT_CALLED") /* LOGOUT_CALLED */, LPGENW("HTTPS_PROXY_AUTH_FAILED") /* HTTPS_PROXY_AUTH_FAILED */, @@ -31,7 +31,7 @@ wchar_t* CSkypeProto::LogoutReasons[] = LPGENW("") /* ACCESS_TOKEN_RENEWAL_FAILED */ }; -wchar_t* CSkypeProto::ValidationReasons[] = +wchar_t* CSkypeProto::ValidationReasons[] = { LPGENW("NOT_VALIDATED") /* NOT_VALIDATED */, LPGENW("Validation succeeded") /* VALIDATED_OK */, @@ -46,7 +46,7 @@ wchar_t* CSkypeProto::ValidationReasons[] = LPGENW("Value starts with an invalid character") /* STARTS_WITH_INVALID_CHAR */, }; -wchar_t* CSkypeProto::PasswordChangeReasons[] = +wchar_t* CSkypeProto::PasswordChangeReasons[] = { LPGENW("Password change succeeded") /* PWD_OK */, LPGENW("") /* PWD_CHANGING */, @@ -58,7 +58,7 @@ wchar_t* CSkypeProto::PasswordChangeReasons[] = LPGENW("Account was currently not logged in") /* PWD_MUST_LOG_IN_TO_CHANGE */, }; -LanguagesListEntry CSkypeProto::languages[] = +LanguagesListEntry CSkypeProto::languages[] = { {"Abkhazian", "ab"}, {"Afar", "aa"}, @@ -322,30 +322,25 @@ int CSkypeProto::DetectAvatarFormat(const wchar_t *path) return CSkypeProto::DetectAvatarFormatBuffer(pBuf); } -static HANDLE hAvatarsFolder = NULL; -static bool bInitDone = false; - void CSkypeProto::InitCustomFolders() { - if (bInitDone) + if (m_bInitDone) return; - bInitDone = true; - if (::ServiceExists(MS_FOLDERS_REGISTER_PATH)) - { - TCHAR AvatarsFolder[MAX_PATH]; - mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM), this->m_szModuleName); - hAvatarsFolder = ::FoldersRegisterCustomPathT(this->m_szModuleName, "Avatars", AvatarsFolder); - } + m_bInitDone = true; + + TCHAR AvatarsFolder[MAX_PATH]; + mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM), this->m_szModuleName); + m_hAvatarsFolder = ::FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder); } wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact) { wchar_t* path = new wchar_t[MAX_PATH]; - + this->InitCustomFolders(); - if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, path, MAX_PATH, _T(""))) + if (m_hAvatarsFolder == NULL || FoldersGetCustomPathT(m_hAvatarsFolder, path, MAX_PATH, _T(""))) { wchar_t *tmpPath = ::Utils_ReplaceVarsT(L"%miranda_avatarcache%"); ::mir_sntprintf(path, MAX_PATH, _T("%s\\") _T(TCHAR_STR_PARAM), tmpPath, this->m_szModuleName); @@ -416,11 +411,11 @@ DWORD CSkypeProto::SendBroadcastAsync(HANDLE hContact, int type, int hResult, HA { ACKDATA *ack = (ACKDATA *)::mir_calloc(sizeof(ACKDATA) + paramSize); ack->cbSize = sizeof(ACKDATA); - ack->szModule = this->m_szModuleName; + ack->szModule = this->m_szModuleName; ack->hContact = hContact; - ack->type = type; + ack->type = type; ack->result = hResult; - ack->hProcess = hProcess; + ack->hProcess = hProcess; ack->lParam = lParam; if (paramSize) ::memcpy(ack+1, (void*)lParam, paramSize); @@ -432,9 +427,9 @@ void CSkypeProto::ForkThread(SkypeThreadFunc pFunc, void *param) { UINT threadID; ::CloseHandle((HANDLE)::mir_forkthreadowner( - (pThreadFuncOwner)*(void**)&pFunc, - this, - param, + (pThreadFuncOwner)*(void**)&pFunc, + this, + param, &threadID)); } @@ -442,9 +437,9 @@ HANDLE CSkypeProto::ForkThreadEx(SkypeThreadFunc pFunc, void *param, UINT* threa { UINT lthreadID; return (HANDLE)::mir_forkthreadowner( - (pThreadFuncOwner)*(void**)&pFunc, + (pThreadFuncOwner)*(void**)&pFunc, this, - param, + param, threadID ? threadID : <hreadID); } @@ -486,7 +481,7 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag if ( !::ServiceExists(MS_POPUP_ADDPOPUPT) || !::DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1)) ::MessageBoxW(NULL, message, caption, MB_OK | flags); - else + else { POPUPDATAT_V2 ppd = {0}; ppd.cbSize = sizeof(POPUPDATAT_V2); @@ -536,13 +531,13 @@ char *CSkypeProto::RemoveHtml(char *text) bool found = false; for (int j=0; j