diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-20 07:18:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-20 07:18:21 +0000 |
commit | 8eaea03b376ddda81c6f31c2cb1d46963b16d8a2 (patch) | |
tree | 1658c07b25e2e75e85a93836687b116229907e64 /protocols | |
parent | b766ebf1a1091dcc2859a92da300c44e0e432a84 (diff) |
total replacement of PROTO_AVATAR_INFORMATION with PROTO_AVATAR_INFORMATIONT
git-svn-id: http://svn.miranda-ng.org/main/trunk@496 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/avatars.cpp | 44 | ||||
-rw-r--r-- | protocols/FacebookRM/proto.cpp | 14 | ||||
-rw-r--r-- | protocols/FacebookRM/proto.h | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/avatar.c | 6 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/core.c | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/services.c | 17 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_avatar.cpp | 4 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/NewsAggregator.cpp | 2 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/Services.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/connection.cpp | 10 | ||||
-rw-r--r-- | protocols/Yahoo/avatar.cpp | 2 |
11 files changed, 53 insertions, 52 deletions
diff --git a/protocols/FacebookRM/avatars.cpp b/protocols/FacebookRM/avatars.cpp index 6b7e735c29..0b3bef5635 100644 --- a/protocols/FacebookRM/avatars.cpp +++ b/protocols/FacebookRM/avatars.cpp @@ -27,12 +27,12 @@ Last change on : $Date: 2011-01-08 11:10:34 +0100 (so, 08 1 2011) $ #include "common.h"
-bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url)
+bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::tstring *url)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
+ if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
{
- std::string new_url = dbv.pszVal;
+ std::tstring new_url = dbv.ptszVal;
DBFreeVariant(&dbv);
if (new_url.empty())
@@ -41,16 +41,16 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *u if (url)
*url = new_url;
- if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
+ if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
{
- std::string ext = new_url.substr(new_url.rfind('.'));
- std::string filename = GetAvatarFolder() + '\\' + dbv.pszVal + ext;
+ std::tstring ext = new_url.substr(new_url.rfind('.'));
+ std::tstring filename = GetAvatarFolder() + '\\' + dbv.ptszVal + ext;
DBFreeVariant(&dbv);
ai.hContact = ai.hContact;
ai.format = ext_to_format(ext);
- strncpy(ai.filename, filename.c_str(), sizeof(ai.filename));
- ai.filename[sizeof(ai.filename)-1] = 0;
+ _tcsncpy(ai.filename, filename.c_str(), SIZEOF(ai.filename));
+ ai.filename[SIZEOF(ai.filename)-1] = 0;
return true;
}
@@ -58,7 +58,7 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *u return false;
}
-void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url)
+void FacebookProto::CheckAvatarChange(HANDLE hContact, std::tstring image_url)
{
// Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts)
if (image_url.empty())
@@ -66,26 +66,26 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) if (DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS))
{
- std::string::size_type pos = image_url.rfind( "_q." );
- if (pos != std::string::npos)
+ std::tstring::size_type pos = image_url.rfind( "_q." );
+ if (pos != std::wstring::npos)
image_url = image_url.replace( pos, 3, "_s." );
}
DBVARIANT dbv;
bool update_required = true;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
+ if (!DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
{
update_required = image_url != dbv.pszVal;
DBFreeVariant(&dbv);
}
if (update_required || !hContact)
{
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
+ DBWriteContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
if (hContact)
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
else
{
- PROTO_AVATAR_INFORMATION ai = {sizeof(ai)};
+ PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
if (GetAvatarInfo(update_required ? GAIF_FORCE : 0, (LPARAM)&ai) != GAIR_WAITFOR)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
}
@@ -100,8 +100,8 @@ void FacebookProto::UpdateAvatarWorker(void *) for (;;)
{
- std::string url;
- PROTO_AVATAR_INFORMATION ai = {sizeof(ai)};
+ std::tstring url;
+ PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
ai.hContact = avatar_queue[0];
if (Miranda_Terminated())
@@ -131,8 +131,8 @@ void FacebookProto::UpdateAvatarWorker(void *) std::string FacebookProto::GetAvatarFolder()
{
- char path[MAX_PATH];
- if ( hAvatarFolder_ && FoldersGetCustomPath(hAvatarFolder_,path,sizeof(path), "") == 0 )
+ TCHAR path[MAX_PATH];
+ if ( hAvatarFolder_ && FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), "") == 0 )
return path;
else
return def_avatar_folder_;
@@ -180,7 +180,7 @@ int FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!lParam)
return GAIR_NOAVATAR;
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATIONT* AI = (PROTO_AVATAR_INFORMATIONT*)lParam;
if (GetDbAvatarInfo(*AI, NULL))
{
@@ -220,14 +220,14 @@ int FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (!wParam || !lParam)
return -3;
- char* buf = ( char* )wParam;
+ TCHAR* buf = ( TCHAR* )wParam;
int size = ( int )lParam;
- PROTO_AVATAR_INFORMATION ai = {sizeof(ai)};
+ PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
switch (GetAvatarInfo(0, (LPARAM)&ai))
{
case GAIR_SUCCESS:
- strncpy(buf, ai.filename, size);
+ _tcsncpy(buf, ai.filename, size);
buf[size-1] = 0;
return 0;
diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index 884fa84149..f53dce96db 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -1,4 +1,4 @@ -/*
+/*
Facebook plugin for Miranda Instant Messenger
_____________________________________________
@@ -41,17 +41,17 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) CreateProtoService(m_szModuleName, PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI, this);
CreateProtoService(m_szModuleName, PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg, this);
- CreateProtoService(m_szModuleName, PS_GETMYAVATAR, &FacebookProto::GetMyAvatar, this);
- CreateProtoService(m_szModuleName, PS_GETAVATARINFO, &FacebookProto::GetAvatarInfo, this);
+ CreateProtoService(m_szModuleName, PS_GETMYAVATART, &FacebookProto::GetMyAvatar, this);
+ CreateProtoService(m_szModuleName, PS_GETAVATARINFOT, &FacebookProto::GetAvatarInfo, this);
CreateProtoService(m_szModuleName, PS_GETAVATARCAPS, &FacebookProto::GetAvatarCaps, this);
CreateProtoService(m_szModuleName, PS_JOINCHAT, &FacebookProto::OnJoinChat, this);
CreateProtoService(m_szModuleName, PS_LEAVECHAT, &FacebookProto::OnLeaveChat, this);
- HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu, this);
- HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit, this);
- HookProtoEvent(ME_GC_EVENT, &FacebookProto::OnChatOutgoing, this);
- HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged, this);
+ HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu, this);
+ HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit, this);
+ HookProtoEvent(ME_GC_EVENT, &FacebookProto::OnChatOutgoing, this);
+ HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged, this);
// Create standard network connection
TCHAR descr[512];
diff --git a/protocols/FacebookRM/proto.h b/protocols/FacebookRM/proto.h index f04f59937c..3ce4af74a9 100644 --- a/protocols/FacebookRM/proto.h +++ b/protocols/FacebookRM/proto.h @@ -187,7 +187,7 @@ public: // Helpers
std::string GetAvatarFolder();
- bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url);
+ bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url);
void CheckAvatarChange(HANDLE hContact, std::string image_url);
void ToggleStatusMenuItems( BOOL bEnable );
diff --git a/protocols/Gadu-Gadu/avatar.c b/protocols/Gadu-Gadu/avatar.c index a0d18e1eb3..39e49c12bf 100644 --- a/protocols/Gadu-Gadu/avatar.c +++ b/protocols/Gadu-Gadu/avatar.c @@ -207,7 +207,7 @@ void __cdecl gg_avatarrequestthread(GGPROTO *gg, void *empty) DBWriteContactSettingByte(hContact, GG_PROTO, GG_KEY_AVATARREQUESTED, 1);
if (iWaitFor) {
- PROTO_AVATAR_INFORMATION pai = {0};
+ PROTO_AVATAR_INFORMATIONT pai = {0};
pai.cbSize = sizeof(pai);
pai.hContact = hContact;
if (gg_getavatarinfo(gg, (WPARAM)GAIF_FORCE, (LPARAM)&pai) != GAIR_WAITFOR)
@@ -222,7 +222,7 @@ void __cdecl gg_avatarrequestthread(GGPROTO *gg, void *empty) GGGETAVATARDATA *data = (GGGETAVATARDATA *)gg->avatar_transfers->data;
NETLIBHTTPREQUEST req = {0};
NETLIBHTTPREQUEST *resp;
- PROTO_AVATAR_INFORMATION pai = {0};
+ PROTO_AVATAR_INFORMATIONT pai = {0};
int result = 0;
pai.cbSize = sizeof(pai);
@@ -301,7 +301,7 @@ void gg_uninitavatarrequestthread(GGPROTO *gg) void __cdecl gg_getuseravatarthread(GGPROTO *gg, void *empty)
{
- PROTO_AVATAR_INFORMATION pai = {0};
+ PROTO_AVATAR_INFORMATIONT pai = {0};
char *AvatarURL;
int AvatarType;
diff --git a/protocols/Gadu-Gadu/core.c b/protocols/Gadu-Gadu/core.c index 4f1ac840bd..0641f7df25 100644 --- a/protocols/Gadu-Gadu/core.c +++ b/protocols/Gadu-Gadu/core.c @@ -1606,7 +1606,7 @@ HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *szNic // Add to notify list and pull avatar for the new contact
if(gg_isonline(gg))
{
- PROTO_AVATAR_INFORMATION pai = {0};
+ PROTO_AVATAR_INFORMATIONT pai = {0};
EnterCriticalSection(&gg->sess_mutex);
gg_add_notify_ex(gg->sess, uin, (char)(inlist ? GG_USER_NORMAL : GG_USER_OFFLINE));
diff --git a/protocols/Gadu-Gadu/services.c b/protocols/Gadu-Gadu/services.c index 7ba24b2328..420d0666ff 100644 --- a/protocols/Gadu-Gadu/services.c +++ b/protocols/Gadu-Gadu/services.c @@ -763,8 +763,9 @@ INT_PTR gg_getavatarcaps(GGPROTO *gg, WPARAM wParam, LPARAM lParam) // gets avatar information
INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam;
- char *AvatarURL = NULL, *AvatarHash = NULL, *AvatarSavedHash = NULL;
+ PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT *)lParam;
+ char *AvatarHash = NULL, *AvatarSavedHash = NULL;
+ TCHAR *AvatarURL = NULL;
INT_PTR result = GAIR_NOAVATAR;
DBVARIANT dbv;
uin_t uin = (uin_t)DBGetContactSettingDword(pai->hContact, GG_PROTO, GG_KEY_UIN, 0);
@@ -785,13 +786,13 @@ INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam) pai->format = DBGetContactSettingByte(pai->hContact, GG_PROTO, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
- if (!DBGetContactSettingString(pai->hContact, GG_PROTO, GG_KEY_AVATARURL, &dbv)) {
- AvatarURL = mir_strdup(dbv.pszVal);
+ if (!DBGetContactSettingTString(pai->hContact, GG_PROTO, GG_KEY_AVATARURL, &dbv)) {
+ AvatarURL = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
}
- if (AvatarURL != NULL && strlen(AvatarURL) > 0) {
- char *AvatarName = strrchr(AvatarURL, '/');
+ if (AvatarURL != NULL && _tcslen(AvatarURL) > 0) {
+ TCHAR *AvatarName = _tcsrchr(AvatarURL, '/');
AvatarName++;
AvatarHash = gg_avatarhash(AvatarName);
}
@@ -842,7 +843,7 @@ INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam) // gets avatar
INT_PTR gg_getmyavatar(GGPROTO *gg, WPARAM wParam, LPARAM lParam)
{
- char *szFilename = (char *)wParam;
+ TCHAR *szFilename = (TCHAR*)wParam;
int len = (int)lParam;
gg_netlog(gg, "gg_getmyavatar(): Requesting user avatar.");
@@ -1009,7 +1010,7 @@ void gg_registerservices(GGPROTO *gg) gg->proto.vtbl->OnEvent = gg_event;
CreateProtoService(PS_GETAVATARCAPS, gg_getavatarcaps, gg);
- CreateProtoService(PS_GETAVATARINFO, gg_getavatarinfo, gg);
+ CreateProtoService(PS_GETAVATARINFOT, gg_getavatarinfo, gg);
CreateProtoService(PS_GETMYAVATAR, gg_getmyavatar, gg);
CreateProtoService(PS_SETMYAVATAR, gg_setmyavatar, gg);
diff --git a/protocols/IcqOscarJ/icq_avatar.cpp b/protocols/IcqOscarJ/icq_avatar.cpp index c49fefe699..99b29b6b76 100644 --- a/protocols/IcqOscarJ/icq_avatar.cpp +++ b/protocols/IcqOscarJ/icq_avatar.cpp @@ -1607,10 +1607,10 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt }
}
- ai.cbSize = sizeof(PROTO_AVATAR_INFORMATION);
+ ai.cbSize = sizeof(PROTO_AVATAR_INFORMATIONT);
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename)); // Avatar API does not support unicode :-(
+ lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
diff --git a/protocols/NewsAggregator/Src/NewsAggregator.cpp b/protocols/NewsAggregator/Src/NewsAggregator.cpp index 716ef85d17..7d33817b86 100644 --- a/protocols/NewsAggregator/Src/NewsAggregator.cpp +++ b/protocols/NewsAggregator/Src/NewsAggregator.cpp @@ -108,7 +108,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) hProtoService[3] = CreateProtoServiceFunction(MODULE, PS_GETSTATUS, NewsAggrGetStatus);
hProtoService[4] = CreateProtoServiceFunction(MODULE, PS_LOADICON, NewsAggrLoadIcon);
hProtoService[5] = CreateProtoServiceFunction(MODULE, PSS_GETINFO, NewsAggrGetInfo);
- hProtoService[6] = CreateProtoServiceFunction(MODULE, PS_GETAVATARINFO, NewsAggrGetAvatarInfo);
+ hProtoService[6] = CreateProtoServiceFunction(MODULE, PS_GETAVATARINFOT, NewsAggrGetAvatarInfo);
hService[0] = CreateServiceFunction(MS_NEWSAGGR_CHECKALLFEEDS, CheckAllFeeds);
hService[1] = CreateServiceFunction(MS_NEWSAGGR_ADDFEED, AddFeed);
diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp index 38213c0ce6..e86e5fdd1f 100644 --- a/protocols/NewsAggregator/Src/Services.cpp +++ b/protocols/NewsAggregator/Src/Services.cpp @@ -231,7 +231,7 @@ INT_PTR CheckFeed(WPARAM wParam,LPARAM lParam) INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam,LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*) lParam;
+ PROTO_AVATAR_INFORMATIONT* pai = (PROTO_AVATAR_INFORMATIONT*) lParam;
if (!IsMyContact(pai->hContact))
return GAIR_NOAVATAR;
diff --git a/protocols/Twitter/connection.cpp b/protocols/Twitter/connection.cpp index 0a3b527eed..0ef143e411 100644 --- a/protocols/Twitter/connection.cpp +++ b/protocols/Twitter/connection.cpp @@ -426,14 +426,14 @@ void TwitterProto::UpdateAvatarWorker(void *p) std::auto_ptr<update_avatar> data( static_cast<update_avatar*>(p) );
DBVARIANT dbv;
- if(DBGetContactSettingString(data->hContact,m_szModuleName,TWITTER_KEY_UN,&dbv))
+ if(DBGetContactSettingTString(data->hContact,m_szModuleName,TWITTER_KEY_UN,&dbv))
return;
std::string ext = data->url.substr(data->url.rfind('.'));
- std::string filename = GetAvatarFolder() + '\\' + dbv.pszVal + ext;
+ std::tstring filename = GetAvatarFolder() + '\\' + dbv.ptszVal + ext;
DBFreeVariant(&dbv);
- PROTO_AVATAR_INFORMATION ai = {sizeof(ai)};
+ PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
ai.hContact = data->hContact;
ai.format = ext_to_format(ext);
@@ -442,7 +442,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this.
}
- strncpy(ai.filename,filename.c_str(),MAX_PATH);
+ _tcsncpy(ai.filename,filename.c_str(),MAX_PATH);
LOG( _T("***** Updating avatar: %s"), data->url.c_str());
WaitForSingleObjectEx(avatar_lock_,INFINITE,true);
@@ -481,7 +481,7 @@ void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool forc // TODO: more defaults (configurable?)
if(url == "http://static.twitter.com/images/default_profile_normal.png")
{
- PROTO_AVATAR_INFORMATION ai = {sizeof(ai),hContact};
+ PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai),hContact};
db_string_set(hContact,m_szModuleName,TWITTER_KEY_AV_URL,url.c_str());
ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_AVATAR,
diff --git a/protocols/Yahoo/avatar.cpp b/protocols/Yahoo/avatar.cpp index 1ee1a64dd8..ad798ed687 100644 --- a/protocols/Yahoo/avatar.cpp +++ b/protocols/Yahoo/avatar.cpp @@ -152,7 +152,7 @@ struct avatar_info{ void __cdecl CYahooProto::recv_avatarthread(void *pavt)
{
- PROTO_AVATAR_INFORMATION AI;
+ PROTO_AVATAR_INFORMATIONT AI;
struct avatar_info *avt = ( avatar_info* )pavt;
int error = 0;
HANDLE hContact = 0;
|