diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-25 14:47:49 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-25 14:47:49 +0000 |
commit | 0dfb1369f0542d884b3553db2d6fe0c0a53fdcdc (patch) | |
tree | a1b73a031dd8c52a4c84485a915aa2699a7e0088 /protocols/VKontakte/src | |
parent | a91b6b87ea7ac3ba8f9af6db1703a2c0b2aa9f3c (diff) |
VKontakte: fix some bugs for set server statusmsg and Auth
git-svn-id: http://svn.miranda-ng.org/main/trunk@10589 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 9 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 142166a8b0..3f19416433 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -60,6 +60,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : Clist_CreateGroup(NULL, m_defaultGroup);
db_set_resident(m_szModuleName, "Status");
+ m_bOne = true;
m_bServerDelivery = getBool("ServerDelivery", true);
m_bHideChats = getBool("HideChats", true);
@@ -170,12 +171,12 @@ void CVkProto::InitMenus() int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM)
{
- bool isFriend = getByte(hContact, "Auth", -1)==0;
+ bool bisFriend = getByte(hContact, "Auth", -1)==0;
Menu_ShowItem(g_hContactMenuItems[CMI_GETALLSERVERHISTORY], !isChatRoom(hContact));
Menu_ShowItem(g_hContactMenuItems[CMI_VISITPROFILE], !isChatRoom(hContact));
- Menu_ShowItem(g_hContactMenuItems[CMI_ADDASFRIEND], !isFriend);
- Menu_ShowItem(g_hContactMenuItems[CMI_DELETEFRIEND], isFriend);
+ Menu_ShowItem(g_hContactMenuItems[CMI_ADDASFRIEND], !bisFriend);
+ Menu_ShowItem(g_hContactMenuItems[CMI_DELETEFRIEND], bisFriend);
return 0;
}
@@ -445,7 +446,7 @@ int CVkProto::AuthRequest(MCONTACT hContact,const PROTOCHAR* message) debugLogA("CVkProto::AuthRequest");
if (!IsOnline())
return 1;
- bool bIsFriend = getBool(hContact, "Auth", -1)==0;
+ bool bIsFriend = getByte(hContact, "Auth", -1)==0;
LONG userID = getDword(hContact, "ID", -1);
if (bIsFriend || (userID == -1) || !hContact)
return 1;
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 03a6995035..6d70fdfa65 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -267,7 +267,7 @@ private: mir_cs m_csRequestsQueue;
HANDLE m_evRequestsQueue;
HANDLE m_hWorkerThread;
- bool m_bTerminated, m_bServerDelivery;
+ bool m_bTerminated, m_bServerDelivery, m_bOne;
CMStringA m_prevUrl;
enum CLMenuIndexes {
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 3735e8384a..bb448a6de0 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -370,8 +370,10 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
else
db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", _T(""));
- if (!hContact)
+ if (!hContact&&m_bOne){
setTString("OldStatusMsg", db_get_tsa(0, m_szModuleName, "StatusMsg"));
+ m_bOne = false;
+ };
szValue = json_as_string(json_get(pRecord, "about"));
if (szValue && *szValue)
@@ -842,7 +844,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) CMString oldStatusMsg = db_get_tsa(0, m_szModuleName, "OldStatusMsg");
if (StatusMsg.IsEmpty()){
if (oldStatusMsg.IsEmpty())
- code = "API.audio.setBroadcast();return null;";
+ code = "API.status.set();return null;";
else{
CMString codeformat("API.status.set({text:\"%s\"});return null;");
code.AppendFormat(codeformat, oldStatusMsg);
@@ -850,9 +852,9 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) }
else {
CMString codeformat("var userID=%d;var StatusMsg=\"%s\";var oldStatus=API.status.get({\"user_id\":userID});"
- "var Track=API.audio.search({\"q\":StatusMsg,\"count\":1});if(Track.count=0){API.status.set({\"text\":StatusMsg});"
+ "var Track=API.audio.search({\"q\":StatusMsg,\"count\":1});if(Track.count==0){API.status.set({\"text\":StatusMsg});"
"return oldStatus;}else{var owner=Track.items[0].owner_id;var trackID=Track.items[0].id;var audioTxt=owner+\"_\"+trackID;"
- "var ids=API.audio.setBroadcast({\"audio\":audioTxt});if(userID=ids[0]){return null;}else{"
+ "var ids=API.audio.setBroadcast({\"audio\":audioTxt});if(userID==ids[0]){return null;}else{"
"API.status.set({\"text\":StatusMsg });return oldStatus;};};");
code.AppendFormat(codeformat, m_myUserId, StatusMsg);
}
|