summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/vk_files.cpp2
-rw-r--r--protocols/VKontakte/src/vk_struct.cpp10
-rw-r--r--protocols/VKontakte/src/vk_struct.h8
3 files changed, 15 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp
index 32c8cbc7fb..ca9822b47a 100644
--- a/protocols/VKontakte/src/vk_files.cpp
+++ b/protocols/VKontakte/src/vk_files.cpp
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
HANDLE CVkProto::SendFile(MCONTACT hContact, const TCHAR *desc, TCHAR **files)
{
debugLogA("CVkProto::SendFile");
- isChatRoom(hContact);
+
LONG userID = getDword(hContact, "ID", -1);
if (!IsOnline() || ((userID == -1 || userID == VK_FEED_USER) && !isChatRoom(hContact)))
return (HANDLE)0;
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp
index ee3163de4c..498075db93 100644
--- a/protocols/VKontakte/src/vk_struct.cpp
+++ b/protocols/VKontakte/src/vk_struct.cpp
@@ -103,7 +103,10 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr)
CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files) :
hContact(_hContact),
Desc(mir_tstrdup(_desc)),
- FileName(mir_tstrdup(_files[0]))
+ FileName(mir_tstrdup(_files[0])),
+ atr(NULL),
+ fname(NULL),
+ filetype(typeInvalid)
{}
CVkFileUploadParam::~CVkFileUploadParam()
@@ -119,6 +122,11 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType()
if (filetype != typeInvalid)
return filetype;
+ if (atr)
+ mir_free(atr);
+ if (fname)
+ mir_free(fname);
+
TCHAR img[] = _T(".jpg .jpeg .png .bmp");
TCHAR audio[] = _T(".mp3");
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h
index ea93b42d02..4f8e0ac1d7 100644
--- a/protocols/VKontakte/src/vk_struct.h
+++ b/protocols/VKontakte/src/vk_struct.h
@@ -92,8 +92,8 @@ struct CVkFileUploadParam : public MZeroedObject {
~CVkFileUploadParam();
VKFileType GetType();
__forceinline bool IsAccess() { return ::_taccess(FileName, 0) == 0; }
- __forceinline char* atrName() { return atr; }
- __forceinline char* fileName() { return fname; }
+ __forceinline char* atrName() { GetType(); return atr; }
+ __forceinline char* fileName() { GetType(); return fname; }
};
struct CVkSendMsgParam : public MZeroedObject
@@ -101,12 +101,14 @@ struct CVkSendMsgParam : public MZeroedObject
CVkSendMsgParam(MCONTACT _hContact, int _iMsgID = 0, int _iCount = 0) :
hContact(_hContact),
iMsgID(_iMsgID),
- iCount(_iCount)
+ iCount(_iCount),
+ pFUP(NULL)
{}
CVkSendMsgParam(MCONTACT _hContact, CVkFileUploadParam *_pFUP) :
hContact(_hContact),
iMsgID(-1),
+ iCount(0),
pFUP(_pFUP)
{}