summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_events.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-12-16 19:08:08 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-12-16 19:08:08 +0000
commit375155f8dcd69863f1b9a220c5f890596844e99d (patch)
tree7e2a2662539ac8f6175e71096ffe6607ed5bf2af /protocols/Skype/src/skype_events.cpp
parent94bb72aca84414a28e556e5fe406eb3bd8cf8567 (diff)
- reworked message receiving/sending (by another instance)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2756 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_events.cpp')
-rw-r--r--protocols/Skype/src/skype_events.cpp79
1 files changed, 78 insertions, 1 deletions
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp
index 541b776e15..8b99ec5219 100644
--- a/protocols/Skype/src/skype_events.cpp
+++ b/protocols/Skype/src/skype_events.cpp
@@ -4,7 +4,7 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
{
this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
this->HookEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit);
- this->login = this->GetSettingString(SKYPE_SETTINGS_LOGIN);
+ this->login = ::DBGetString(NULL, this->m_szModuleName, "sid");
this->rememberPassword = this->GetSettingByte("RememberPassword") > 0;
return 0;
@@ -23,3 +23,80 @@ int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam)
return 0;
}
+
+void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message)
+{
+ uint timestamp;
+ message->GetPropTimestamp(timestamp);
+
+ SEString data;
+
+ message->GetPropAuthor(data);
+ char *sid = ::mir_strdup((const char*)data);
+
+ message->GetPropBodyXml(data);
+ char *text = ::mir_strdup((const char*)data);
+
+ Participant::Refs participants;
+ conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
+
+ for (uint i = 0; i < participants.size(); i ++)
+ {
+ participants[i]->GetPropIdentity(data);
+ char *contactSid = ::mir_strdup((const char *)data);
+ //todo: get nickname
+ this->RaiseMessageSendedEvent(
+ timestamp,
+ contactSid,
+ contactSid,
+ text);
+ }
+}
+
+void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message)
+{
+ uint timestamp;
+ message->GetPropTimestamp(timestamp);
+
+ SEString data;
+
+ message->GetPropAuthor(data);
+ char *sid = ::mir_strdup((const char*)data);
+
+ message->GetPropAuthorDisplayname(data);
+ char *nick = ::mir_strdup((const char*)data);
+
+ message->GetPropBodyXml(data);
+ char *text = ::mir_strdup((const char*)data);
+
+ this->RaiseMessageReceivedEvent(
+ (DWORD)timestamp,
+ sid,
+ nick,
+ text);
+
+ /*const char *msg = (const char*)propValues[2];
+ int len = ::strlen(msg) + 8;
+ wchar_t *xml = new wchar_t[len];
+ ::mir_sntprintf(xml, len, L"<m>%s</m>", ::mir_utf8decodeW(msg));
+
+ int bytesProcessed = 0;
+ HXML hXml = xi.parseString(xml, &bytesProcessed, NULL);*/
+}
+
+void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref message)
+{
+ CMessage::TYPE messageType;
+ message->GetPropType(messageType);
+
+ CMessage::SENDING_STATUS sendingStatus;
+ message->GetPropSendingStatus(sendingStatus);
+
+ if (messageType == CMessage::POSTED_TEXT)
+ {
+ if (sendingStatus == CMessage::SENT)
+ this->OnMessageSended(conversation, message);
+ else if (!sendingStatus)
+ this->OnMessageReceived(conversation, message);
+ }
+} \ No newline at end of file