From 090353f5daa6bbe3e80225392bcd3de6ca39f3a1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Mar 2013 16:58:06 +0000 Subject: fix for registering relative avatar path in Twitter git-svn-id: http://svn.miranda-ng.org/main/trunk@3845 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/src/proto.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'protocols/Twitter/src/proto.cpp') diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 7f587d73c5..3f42a70d17 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -48,18 +48,17 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username) HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &TwitterProto::OnBuildStatusMenu, this); HookProtoEvent(ME_OPT_INITIALISE, &TwitterProto::OnOptionsInit, this); - def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName; - hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, def_avatar_folder_.c_str(), m_tszUserName); + tstring defFolder = std::tstring( _T("%miranda_avatarcache%\\")) + m_tszUserName; + hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, defFolder.c_str(), m_tszUserName); // Initialize hotkeys char text[512]; + mir_snprintf(text,SIZEOF(text),"%s/Tweet",m_szModuleName); + HOTKEYDESC hkd = {sizeof(hkd)}; - hkd.cbSize = sizeof(hkd); hkd.pszName = text; hkd.pszService = text; hkd.pszSection = m_szModuleName; // Section title; TODO: use username? - - mir_snprintf(text,SIZEOF(text),"%s/Tweet",m_szModuleName); hkd.pszDescription = "Send Tweet"; Hotkey_Register(&hkd); @@ -550,10 +549,9 @@ void TwitterProto::UpdateSettings() std::tstring TwitterProto::GetAvatarFolder() { TCHAR path[MAX_PATH]; - if(hAvatarFolder_ && FoldersGetCustomPathT(hAvatarFolder_,path,SIZEOF(path), _T("")) == 0) - return path; - - return def_avatar_folder_; + if (!hAvatarFolder_ || FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), _T(""))) + mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName); + return path; } int TwitterProto::GetAvatar(WPARAM,LPARAM) -- cgit v1.2.3