diff options
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 32 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_pollserver.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.h | 11 |
8 files changed, 61 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 7285cbe74d..5710d707a3 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1019,12 +1019,16 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport CMString tszUrl(jnLink["url"].as_mstring());
CMString tszTitle(jnLink["title"].as_mstring());
+ CMString tszCaption(jnLink["caption"].as_mstring());
CMString tszDescription(jnLink["description"].as_mstring());
res.AppendFormat(_T("%s: %s"),
SetBBCString(TranslateT("Link"), iBBC, vkbbcB),
SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
-
+
+ if (!tszDescription.IsEmpty())
+ res.AppendFormat(_T("\n\t%s"), SetBBCString(tszCaption, iBBC, vkbbcI));
+
if (jnLink["photo"])
res.AppendFormat(_T("\n\t%s"), GetVkPhotoItem(jnLink["photo"], iBBC));
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 5f067dfbd6..39d0d3708a 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 1
-#define __BUILD_NUM 18
+#define __BUILD_NUM 19
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 48efc7069d..3ccc5f89b1 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -80,7 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define VKERR_INVALID_URL 10106 // Upload server returned empty URL
#define VKERR_INVALID_USER 10107 // Invalid or unknown recipient user ID
-#define VK_API_VER "5.37"
+#define VK_API_VER "5.40"
#define VER_API CHAR_PARAM("v", VK_API_VER)
#define VK_FEED_USER 2147483647L
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 555d5fd06f..ae045d66fe 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -877,6 +877,38 @@ int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam) return 0;
}
+void CVkProto::ChatContactTypingThread(void * p)
+{
+ CVKChatContactTypingParam *param = (CVKChatContactTypingParam *)p;
+ if (!p)
+ return;
+
+ int iChatId = param->m_ChatId;
+ int iUserId = param->m_UserId;
+
+ delete param;
+
+ MCONTACT hChatContact = FindChat(iChatId);
+ if (hChatContact && getBool(hChatContact, "off"))
+ return;
+
+ CVkChatInfo *cc = (CVkChatInfo*)m_chats.find((CVkChatInfo*)&iChatId);
+ if (cc == NULL)
+ return;
+
+ CVkChatUser* cu = cc->GetUserById(iUserId);
+ if (cu == NULL)
+ return;
+
+ StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick); + + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
+ Sleep(5500);
+ CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
static void FilterContacts(HWND hwndDlg, CVkProto *ppro)
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 84058a9dcf..fcff46c070 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -163,6 +163,10 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) }
break;
+ case VKPOLL_CHAT_UTN:
+ ForkThread(&CVkProto::ChatContactTypingThread, new CVKChatContactTypingParam(jnChild[2].as_int(), jnChild[1].as_int()));
+ break;
+
case VKPOLL_CHAT_CHANGED:
int chat_id = jnChild[1].as_int();
CVkChatInfo *cc = m_chats.find((CVkChatInfo*)&chat_id);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 8eee5fe7c4..70c5643093 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -200,6 +200,8 @@ struct CVkProto : public PROTO<CVkProto> void SetMirVer(MCONTACT hContact, int platform);
void __cdecl ContactTypingThread(void *p);
+ void __cdecl ChatContactTypingThread(void *p);
+
void SetSrmmReadStatus(MCONTACT hContact);
void MarkDialogAsRead(MCONTACT hContact);
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index 498075db93..41cc4296e0 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -161,4 +161,9 @@ CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId) return m_users.find((CVkChatUser*)&user_id);
}
+CVkChatUser* CVkChatInfo::GetUserById(int user_id)
+{
+ return m_users.find((CVkChatUser*)&user_id);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 649d3f1acd..1a55218a55 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -165,6 +165,7 @@ struct CVkChatInfo : public MZeroedObject OBJLIST<CVkChatMessage> m_msgs;
CVkChatUser* GetUserById(LPCTSTR);
+ CVkChatUser* GetUserById(int user_id);
};
struct CVkUserInfo : public MZeroedObject {
@@ -226,4 +227,14 @@ struct CVKBBCItem { VKBBCType vkBBCType;
BBCSupport vkBBCSettings;
TCHAR *ptszTempate;
+};
+
+struct CVKChatContactTypingParam {
+ CVKChatContactTypingParam(int pChatId, int pUserId) :
+ m_ChatId(pChatId),
+ m_UserId(pUserId)
+ {}
+
+ int m_ChatId;
+ int m_UserId;
};
\ No newline at end of file |