diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-09-07 15:30:02 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-09-07 15:30:02 +0000 |
commit | c76cb483df20f8058deedcf5500b20ea5af98cf6 (patch) | |
tree | f8037ae70e781efbde6d56864c7cb9b9f508e15c /protocols/VKontakte/src/vk_proto.h | |
parent | 19dbdd9ae7fd04bde5d5761bce97344842d2a6d9 (diff) |
VKontakte:
code refactoring
fix memory leaks and corruption
fix for support MessageState
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@15294 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_proto.h')
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 215 |
1 files changed, 5 insertions, 210 deletions
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index e646312f2f..84fccf2644 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "stdafx.h"
+#pragma once
+
#define PS_CREATECHAT "/CreateNewChat"
#define PS_LOADVKNEWS "/LoadVKNews"
#define PS_GETSERVERHISTORY "/SyncHistory"
@@ -36,215 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MAXHISTORYMIDSPERONE 175
#define MAX_RETRIES 10
-struct CVkProto;
-typedef void (CVkProto::*VK_REQUEST_HANDLER)(NETLIBHTTPREQUEST*, struct AsyncHttpRequest*);
-
-struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject
-{
- enum RequestPriority { rpLow, rpMedium, rpHigh };
-
- AsyncHttpRequest();
- AsyncHttpRequest(CVkProto*, int iRequestType, LPCSTR szUrl, bool bSecure, VK_REQUEST_HANDLER pFunc, RequestPriority rpPriority = rpMedium);
- ~AsyncHttpRequest();
-
- void AddHeader(LPCSTR, LPCSTR);
- void Redirect(NETLIBHTTPREQUEST*);
-
- CMStringA m_szUrl;
- CMStringA m_szParam;
- VK_REQUEST_HANDLER m_pFunc;
- void *pUserInfo;
- int m_iRetry;
- RequestPriority m_priority;
- static ULONG m_reqCount;
- ULONG m_reqNum;
- bool m_bApiReq;
- bool bExpUrlEncode;
- bool bNeedsRestart, bIsMainConn;
-};
-
-struct PARAM
-{
- LPCSTR szName;
- __forceinline PARAM(LPCSTR _name) : szName(_name)
- {}
-};
-
-struct INT_PARAM : public PARAM
-{
- int iValue;
- __forceinline INT_PARAM(LPCSTR _name, int _value) :
- PARAM(_name), iValue(_value)
- {}
-};
-AsyncHttpRequest* operator<<(AsyncHttpRequest*, const INT_PARAM&);
-
-struct CHAR_PARAM : public PARAM
-{
- LPCSTR szValue;
- __forceinline CHAR_PARAM(LPCSTR _name, LPCSTR _value) :
- PARAM(_name), szValue(_value)
- {}
-};
-AsyncHttpRequest* operator<<(AsyncHttpRequest*, const CHAR_PARAM&);
-
-struct TCHAR_PARAM : public PARAM
-{
- LPCTSTR tszValue;
- __forceinline TCHAR_PARAM(LPCSTR _name, LPCTSTR _value) :
- PARAM(_name), tszValue(_value)
- {}
-};
-AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&);
-
-struct CVkSendMsgParam
-{
- CVkSendMsgParam(MCONTACT _p1, int _p2 = 0, int _p3 = 0) :
- hContact(_p1),
- iMsgID(_p2),
- iCount(_p3)
- {}
-
- MCONTACT hContact;
- int iMsgID;
- int iCount;
-};
-
-struct CVkChatMessage : public MZeroedObject
-{
- CVkChatMessage(int _id) :
- m_mid(_id),
- m_uid(0),
- m_date(0),
- m_bHistory(false),
- m_bIsAction(false)
- {}
-
- int m_mid, m_uid, m_date;
- bool m_bHistory, m_bIsAction;
- ptrT m_tszBody;
-};
-
-struct CVkChatUser : public MZeroedObject
-{
- CVkChatUser(int _id) :
- m_uid(_id),
- m_bDel(false),
- m_bUnknown(false)
- {}
-
- int m_uid;
- bool m_bDel, m_bUnknown;
- ptrT m_tszNick;
-};
-
-struct CVkChatInfo : public MZeroedObject
-{
- CVkChatInfo(int _id) :
- m_users(10, NumericKeySortT),
- m_msgs(10, NumericKeySortT),
- m_chatid(_id),
- m_admin_id(0),
- m_bHistoryRead(0),
- m_hContact(INVALID_CONTACT_ID)
- {}
-
- int m_chatid, m_admin_id;
- bool m_bHistoryRead;
- ptrT m_tszTopic, m_tszId;
- MCONTACT m_hContact;
- OBJLIST<CVkChatUser> m_users;
- OBJLIST<CVkChatMessage> m_msgs;
-
- CVkChatUser* GetUserById(LPCTSTR);
-};
-
-struct CVkFileUploadParam {
- enum VKFileType {typeInvalid, typeImg, typeAudio, typeDoc, typeNotSupported};
- TCHAR* FileName;
- TCHAR* Desc;
- char* atr;
- char* fname;
- MCONTACT hContact;
- VKFileType filetype;
- int iErrorCode;
-
- CVkFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files);
- ~CVkFileUploadParam();
- VKFileType GetType();
- __forceinline bool IsAccess() { return ::_taccess(FileName, 0) == 0; }
- __forceinline char* atrName() { return atr; }
- __forceinline char* fileName() { return fname; }
-};
-
-struct CVkUserInfo : public MZeroedObject {
- CVkUserInfo(LONG _UserId) :
- m_UserId(_UserId),
- m_bIsGroup(false)
- {}
-
- CVkUserInfo(LONG _UserId, bool _bIsGroup, CMString& _tszUserNick, CMString& _tszLink, MCONTACT _hContact = NULL) :
- m_UserId(_UserId),
- m_bIsGroup(_bIsGroup),
- m_tszUserNick(_tszUserNick),
- m_tszLink(_tszLink),
- m_hContact(_hContact)
- {}
-
- LONG m_UserId;
- MCONTACT m_hContact;
- CMString m_tszUserNick;
- CMString m_tszLink;
- bool m_bIsGroup;
-};
-
-enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy, vkInvite };
-
-struct CVKNotification {
- TCHAR *ptszType;
- VKObjType vkParent, vkFeedback;
- TCHAR *ptszTranslate;
-};
-
-struct CVKNewsItem : public MZeroedObject {
- CVKNewsItem() :
- tDate(NULL),
- vkUser(NULL),
- bIsGroup(false),
- bIsRepost(false),
- vkFeedbackType(vkNull),
- vkParentType(vkNull)
- {}
-
- CMString tszId;
- time_t tDate;
- CVkUserInfo *vkUser;
- CMString tszText;
- CMString tszLink;
- CMString tszType;
- VKObjType vkFeedbackType, vkParentType;
- bool bIsGroup;
- bool bIsRepost;
-};
-
-enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor };
-enum BBCSupport { bbcNo, bbcBasic, bbcAdvanced };
-
-struct CVKBBCItem {
- VKBBCType vkBBCType;
- BBCSupport vkBBCSettings;
- TCHAR *ptszTempate;
-};
-
-struct TFakeAckParams
-{
- __inline TFakeAckParams(MCONTACT _hContact, int _msgid) :
- hContact(_hContact), msgid(_msgid)
- {}
-
- MCONTACT hContact;
- int msgid;
-};
struct CVkProto : public PROTO<CVkProto>
{
@@ -336,13 +130,14 @@ struct CVkProto : public PROTO<CVkProto> void __cdecl SearchBasicThread(void* id);
void __cdecl SearchByMailThread(void* email);
void __cdecl SearchThread(void* p);
+ void FreeProtoShearchStruct(PROTOSEARCHBYNAME *pParam);
void OnSearch(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnSearchByMail(NETLIBHTTPREQUEST *, AsyncHttpRequest *);
//==== Files Upload ==================================================================
void __cdecl SendFileThread(void *p);
- void SendFileFiled(CVkFileUploadParam *fup, TCHAR* reason = NULL);
+ void SendFileFiled(CVkFileUploadParam *fup, int ErrorCode);
void OnReciveUploadServer(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReciveUpload(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReciveUploadFile(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
|