diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-25 05:28:10 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-25 05:28:10 +0000 |
commit | d9342e0a5916cf57df80b4400d7ce3482a94db5e (patch) | |
tree | 136017fbaaef03fd7cd14b4418523b4f95905015 /protocols | |
parent | 5abf533213e126786cb859be514656a9fb3a514f (diff) |
VKontakte:
small memory leak fix
add status message support
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@12262 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/res/resource.rc | 1 | ||||
-rw-r--r-- | protocols/VKontakte/res/status.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/resource.h | 3 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 48 | ||||
-rw-r--r-- | protocols/VKontakte/vk_10.vcxproj | 1 | ||||
-rw-r--r-- | protocols/VKontakte/vk_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/VKontakte/vk_12.vcxproj | 1 | ||||
-rw-r--r-- | protocols/VKontakte/vk_12.vcxproj.filters | 3 |
12 files changed, 72 insertions, 7 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 5d242302ca..f199e9e1aa 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -35,6 +35,7 @@ IDI_VISITPROFILE ICON "home.ico" IDI_HISTORY ICON "history.ico"
IDI_KEYS ICON "key.ico"
IDI_BROADCAST ICON "broadcast.ico"
+IDI_STATUS ICON "status.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/VKontakte/res/status.ico b/protocols/VKontakte/res/status.ico Binary files differnew file mode 100644 index 0000000000..d087d077c6 --- /dev/null +++ b/protocols/VKontakte/res/status.ico diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 262e9fd14e..2098bd6f15 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -79,7 +79,8 @@ static IconItem iconList[] = { LPGEN("Delete from friend list icon"), "delfriend", IDI_FRIENDDEL },
{ LPGEN("Report abuse icon"), "abuse", IDI_ABUSE },
{ LPGEN("Ban user icon"), "ban", IDI_BAN },
- { LPGEN("Broadcast icon"), "broadcast", IDI_BROADCAST }
+ { LPGEN("Broadcast icon"), "broadcast", IDI_BROADCAST },
+ { LPGEN("Status icon"), "status", IDI_STATUS }
};
void InitIcons()
@@ -481,7 +482,7 @@ CMString CVkProto::RunConfirmationCode() pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
- return (!EnterString(&pForm)) ? CMString() : CMString(pForm.ptszResult);
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 3d12fda3a5..c9d06a8f0e 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -19,6 +19,7 @@ #define IDI_HISTORY 116
#define IDI_BROADCAST 117
#define IDD_OPT_VIEW 118
+#define IDI_STATUS 119
#define IDI_KEYS 203
#define IDC_LOGIN 1001
#define IDC_PASSWORD 1002
@@ -102,7 +103,7 @@ #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
-#define _APS_NEXT_RESOURCE_VALUE 119
+#define _APS_NEXT_RESOURCE_VALUE 120
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1091
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index ee7100bdab..531b952080 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 48
+#define __BUILD_NUM 49
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 01d7f7844c..39fcd06e2d 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -178,6 +178,7 @@ void CVkProto::InitMenus() CreateProtoService(PS_DESTROYKICKCHAT, &CVkProto::SvcDestroyKickChat);
CreateProtoService(PS_OPENBROADCAST, &CVkProto::SvcOpenBroadcast);
CreateProtoService(PS_LOADVKNEWS, &CVkProto::SvcLoadVKNews);
+ CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
CLISTMENUITEM mi = { sizeof(mi) };
char szService[100];
@@ -193,6 +194,13 @@ void CVkProto::InitMenus() mi.pszName = LPGEN("Create new chat");
g_hProtoMenuItems[PMI_CREATECHAT] = Menu_AddProtoMenuItem(&mi);
+ mir_snprintf(szService, SIZEOF(szService), "%s%s", m_szModuleName, PS_SETSTATUSMSG);
+ mi.pszService = szService;
+ mi.position = 10009 + PMI_SETSTATUSMSG;
+ mi.icolibItem = Skin_GetIconByHandle(GetIconHandle(IDI_STATUS));
+ mi.pszName = LPGEN("Status message");
+ g_hProtoMenuItems[PMI_SETSTATUSMSG] = Menu_AddProtoMenuItem(&mi);
+
mir_snprintf(szService, SIZEOF(szService), "%s%s", m_szModuleName, PS_LOADVKNEWS);
mi.pszService = szService;
mi.position = 10009 + PMI_LOADVKNEWS;
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 3fe57eb15c..babd8f45f2 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PS_REPORTABUSE "/ReportAbuse"
#define PS_DESTROYKICKCHAT "/DestroyKickChat"
#define PS_OPENBROADCAST "/OpenBroadcast"
+#define PS_SETSTATUSMSG "/SetStatusMsg"
#define MAXHISTORYMIDSPERONE 200
#define MAX_RETRIES 10
@@ -319,6 +320,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcReportAbuse(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcDestroyKickChat(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcOpenBroadcast(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl SvcSetStatusMsg(WPARAM, LPARAM);
//==== History Menus ==================================================================
@@ -430,6 +432,7 @@ struct CVkProto : public PROTO<CVkProto> void RetrieveStatusMsg(const CMString &StatusMsg);
void RetrieveStatusMusic(const CMString &StatusMsg);
void OnReceiveStatus(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
+ void OnReceiveStatusMsg(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
MCONTACT SetContactInfo(JSONNODE* Item, bool flag = false, bool self = false);
void RetrieveMyInfo(void);
@@ -511,6 +514,7 @@ private: };
enum ProtoMenuIndexes {
PMI_CREATECHAT,
+ PMI_SETSTATUSMSG,
PMI_LOADVKNEWS,
PMI_VISITPROFILE,
PMI_COUNT
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 173dd76f66..9e27ba6d36 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -1023,6 +1023,50 @@ void CVkProto::PollingThread(void*) /////////////////////////////////////////////////////////////////////////////////////////
+INT_PTR __cdecl CVkProto::SvcSetStatusMsg(WPARAM, LPARAM)
+{
+ debugLogA("CVkProto::SvcSetStatusMsg");
+ if (!IsOnline())
+ return 1;
+
+ MsgPopup(NULL, TranslateT("Loading status message from vk.com.\nThis may take some time."), TranslateT("Waiting..."));
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/status.get.json", true, &CVkProto::OnReceiveStatusMsg)
+ << VER_API);
+
+ return 0;
+}
+
+void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
+{
+ debugLogA("CVkProto::OnReceiveStatusMsg %d", reply->resultCode);
+ if (reply->resultCode != 200)
+ return;
+
+ OnReceiveStatus(reply, pReq);
+
+ ptrT ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
+ CMString tszOldStatusMsg(ptszOldStatusMsg);
+
+ ENTER_STRING pForm = { sizeof(pForm) };
+ pForm.type = ESF_MULTILINE;
+ pForm.caption = TranslateT("Enter new status message");
+ pForm.ptszInitVal = ptszOldStatusMsg;
+ pForm.szModuleName = m_szModuleName;
+ pForm.szDataPrefix = "statusmsgform_";
+
+ if (!EnterString(&pForm))
+ return;
+
+ CMString tszNewStatusMsg(ptrT(pForm.ptszResult));
+ if (tszOldStatusMsg == tszNewStatusMsg)
+ return;
+
+ RetrieveStatusMsg(tszNewStatusMsg);
+ setTString("OldStatusMsg", ptszOldStatusMsg);
+}
+
+
void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnReceiveStatus %d", reply->resultCode);
@@ -1309,6 +1353,4 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)tszUrl.GetBuffer());
return 0;
-}
-
-
+}
\ No newline at end of file diff --git a/protocols/VKontakte/vk_10.vcxproj b/protocols/VKontakte/vk_10.vcxproj index 3fe519c80d..f0ccfad283 100644 --- a/protocols/VKontakte/vk_10.vcxproj +++ b/protocols/VKontakte/vk_10.vcxproj @@ -214,6 +214,7 @@ <None Include="res\notify.ico" />
<None Include="res\read.ico" />
<None Include="res\report.ico" />
+ <None Include="res\status.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/VKontakte/vk_10.vcxproj.filters b/protocols/VKontakte/vk_10.vcxproj.filters index 252f7625db..83df172d18 100644 --- a/protocols/VKontakte/vk_10.vcxproj.filters +++ b/protocols/VKontakte/vk_10.vcxproj.filters @@ -117,5 +117,8 @@ <None Include="res\read.ico">
<Filter>Resource Files\Icons</Filter>
</None>
+ <None Include="res\status.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </None>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/protocols/VKontakte/vk_12.vcxproj b/protocols/VKontakte/vk_12.vcxproj index aaf94fb2e4..18acb8719e 100644 --- a/protocols/VKontakte/vk_12.vcxproj +++ b/protocols/VKontakte/vk_12.vcxproj @@ -217,6 +217,7 @@ <Image Include="res\notify.ico" />
<Image Include="res\read.ico" />
<Image Include="res\report.ico" />
+ <Image Include="res\status.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/VKontakte/vk_12.vcxproj.filters b/protocols/VKontakte/vk_12.vcxproj.filters index 6ce39b7884..41ceea8205 100644 --- a/protocols/VKontakte/vk_12.vcxproj.filters +++ b/protocols/VKontakte/vk_12.vcxproj.filters @@ -117,5 +117,8 @@ <Image Include="res\read.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
+ <Image Include="res\status.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
</ItemGroup>
</Project>
\ No newline at end of file |