diff options
Diffstat (limited to 'protocols/Twitter')
-rw-r--r-- | protocols/Twitter/connection.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/proto.cpp | 17 | ||||
-rw-r--r-- | protocols/Twitter/proto.h | 5 | ||||
-rw-r--r-- | protocols/Twitter/utility.cpp | 10 | ||||
-rw-r--r-- | protocols/Twitter/utility.h | 2 |
5 files changed, 17 insertions, 19 deletions
diff --git a/protocols/Twitter/connection.cpp b/protocols/Twitter/connection.cpp index 0ef143e411..02d2244081 100644 --- a/protocols/Twitter/connection.cpp +++ b/protocols/Twitter/connection.cpp @@ -430,7 +430,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return;
std::string ext = data->url.substr(data->url.rfind('.'));
- std::tstring filename = GetAvatarFolder() + '\\' + dbv.ptszVal + ext;
+ std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
DBFreeVariant(&dbv);
PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp index ae1567e986..60f802d77c 100644 --- a/protocols/Twitter/proto.cpp +++ b/protocols/Twitter/proto.cpp @@ -50,11 +50,10 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username) HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &TwitterProto::OnBuildStatusMenu, this);
HookProtoEvent(ME_OPT_INITIALISE, &TwitterProto::OnOptionsInit, this);
- char *profile = Utils_ReplaceVars("%miranda_avatarcache%");
- def_avatar_folder_ = std::string(profile)+"\\"+m_szModuleName;
+ TCHAR *profile = Utils_ReplaceVarsT( _T("%miranda_avatarcache%"));
+ def_avatar_folder_ = std::tstring(profile) + _T("\\") + m_tszUserName;
mir_free(profile);
- hAvatarFolder_ = FoldersRegisterCustomPath(m_szModuleName,"Avatars",
- def_avatar_folder_.c_str());
+ hAvatarFolder_ = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", def_avatar_folder_.c_str());
// Initialize hotkeys
char text[512];
@@ -572,13 +571,13 @@ void TwitterProto::UpdateSettings() }
}
-std::string TwitterProto::GetAvatarFolder()
+std::tstring TwitterProto::GetAvatarFolder()
{
- char path[MAX_PATH];
- if(hAvatarFolder_ && FoldersGetCustomPath(hAvatarFolder_,path,sizeof(path), "") == 0)
+ TCHAR path[MAX_PATH];
+ if(hAvatarFolder_ && FoldersGetCustomPathT(hAvatarFolder_,path,SIZEOF(path), _T("")) == 0)
return path;
- else
- return def_avatar_folder_;
+
+ return def_avatar_folder_;
}
int TwitterProto::GetAvatar(WPARAM,LPARAM)
diff --git a/protocols/Twitter/proto.h b/protocols/Twitter/proto.h index 6cea35b33d..eb5b9a2198 100644 --- a/protocols/Twitter/proto.h +++ b/protocols/Twitter/proto.h @@ -157,8 +157,7 @@ private: void TwitterProto::resetOAuthKeys();
-
- std::string GetAvatarFolder();
+ std::tstring GetAvatarFolder();
HANDLE signon_lock_;
HANDLE avatar_lock_;
@@ -172,7 +171,7 @@ private: twitter_id since_id_;
twitter_id dm_since_id_;
- std::string def_avatar_folder_;
+ std::tstring def_avatar_folder_;
HANDLE hAvatarFolder_;
bool in_chat_;
diff --git a/protocols/Twitter/utility.cpp b/protocols/Twitter/utility.cpp index 2f79a40e99..3b98944bba 100644 --- a/protocols/Twitter/utility.cpp +++ b/protocols/Twitter/utility.cpp @@ -173,7 +173,7 @@ int mir_twitter::WLOG(const char* first, const std::wstring last) return LOG(first, str1);
}
-bool save_url(HANDLE hNetlib,const std::string &url,const std::string &filename)
+bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename)
{
NETLIBHTTPREQUEST req = {sizeof(req)};
NETLIBHTTPREQUEST *resp;
@@ -189,12 +189,12 @@ bool save_url(HANDLE hNetlib,const std::string &url,const std::string &filename) if (resp->resultCode == 200)
{
// Create folder if necessary
- std::string dir = filename.substr(0,filename.rfind('\\'));
- if(_access(dir.c_str(),0))
- CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM)dir.c_str());
+ std::tstring dir = filename.substr(0,filename.rfind('\\'));
+ if( _taccess(dir.c_str(),0))
+ CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)dir.c_str());
// Write to file
- FILE *f = fopen(filename.c_str(),"wb");
+ FILE *f = _tfopen(filename.c_str(), _T("wb"));
fwrite(resp->pData,1,resp->dataLength,f);
fclose(f);
}
diff --git a/protocols/Twitter/utility.h b/protocols/Twitter/utility.h index cc60ee15c4..a8823291d1 100644 --- a/protocols/Twitter/utility.h +++ b/protocols/Twitter/utility.h @@ -155,4 +155,4 @@ private: };
int ext_to_format(const std::string &ext);
-bool save_url(HANDLE hNetlib,const std::string &url,const std::string &filename);
\ No newline at end of file +bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename);
\ No newline at end of file |