summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_subclassing.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-12-16 13:16:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-12-16 13:16:42 +0000
commit2ae148d3b9040ab734642ea0bc798bede8a06dfa (patch)
tree83b34145df1307627ac3d3bb9156e17383f81687 /protocols/Skype/src/skype_subclassing.cpp
parenta3b6e54b51ddf79756a0916740988182637c0cc0 (diff)
- refactored message receiving
git-svn-id: http://svn.miranda-ng.org/main/trunk@2751 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_subclassing.cpp')
-rw-r--r--protocols/Skype/src/skype_subclassing.cpp69
1 files changed, 45 insertions, 24 deletions
diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp
index e6b6ec6d34..4ae99d087a 100644
--- a/protocols/Skype/src/skype_subclassing.cpp
+++ b/protocols/Skype/src/skype_subclassing.cpp
@@ -5,7 +5,8 @@
CSkype::CSkype(int num_threads) : Skype(num_threads)
{
this->proto = NULL;
- this->callback == NULL;
+ this->onMessageReceivedCallback = NULL;
+ this->onConversationAddedCallback = NULL;
}
CAccount* CSkype::newAccount(int oid)
@@ -28,11 +29,45 @@ CConversation* CSkype::newConversation(int oid)
return new CConversation(oid, this);
}
+CMessage* CSkype::newMessage(int oid)
+{
+ return new CMessage(oid, this);
+}
+
CContactSearch* CSkype::newContactSearch(int oid)
{
return new CContactSearch(oid, this);
}
+void CSkype::OnMessage (
+ const MessageRef & message,
+ const bool & changesInboxTimestamp,
+ const MessageRef & supersedesHistoryMessage,
+ const ConversationRef & conversation)
+{
+ /*uint now;
+ skype->GetUnixTimestamp(now);
+ conversation->SetConsumedHorizon(now);*/
+
+ Message::TYPE messageType;
+ message->GetPropType(messageType);
+
+ Message::SENDING_STATUS sendingStatus;
+ message->GetPropSendingStatus(sendingStatus);
+
+ if (messageType == Message::POSTED_TEXT && !sendingStatus)
+ {
+ if (this->proto)
+ (proto->*onMessageReceivedCallback)(message->ref());
+ }
+}
+
+void CSkype::SetOnMessageReceivedCallback(OnMessageReceived callback, CSkypeProto* proto)
+{
+ this->proto = proto;
+ this->onMessageReceivedCallback = callback;
+}
+
void CSkype::OnConversationListChange(
const ConversationRef &conversation,
const Conversation::LIST_TYPE &type,
@@ -43,14 +78,14 @@ void CSkype::OnConversationListChange(
conversation.fetch();
inbox.append(conversation);
if (this->proto)
- (proto->*callback)(conversation->ref());
+ (proto->*onConversationAddedCallback)(conversation->ref());
}
}
void CSkype::SetOnConversationAddedCallback(OnConversationAdded callback, CSkypeProto* proto)
{
this->proto = proto;
- this->callback = callback;
+ this->onConversationAddedCallback = callback;
}
// CAccount
@@ -186,30 +221,16 @@ CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversatio
void CConversation::OnMessage(const MessageRef & message)
{
- Message::TYPE messageType;
- message->GetPropType(messageType);
-
- Message::SENDING_STATUS sendingStatus;
- message->GetPropSendingStatus(sendingStatus);
-
- if (messageType == Message::POSTED_TEXT && !sendingStatus)
- {
- SEIntList propIds;
- SEIntDict propValues;
- propIds.append(Message::P_AUTHOR);
- propIds.append(Message::P_BODY_XML);
- propValues = message->GetProps(propIds);
-
- //if (propValues[0] != myAccountName)
- {
- if (this->proto)
- (proto->*callback)((const char*)propValues[0], (const char*)propValues[1]);
- }
- }
+ if (this->proto)
+ (proto->*callback)(message->ref());
}
void CConversation::SetOnMessageReceivedCallback(OnMessageReceived callback, CSkypeProto* proto)
{
this->proto = proto;
this->callback = callback;
-} \ No newline at end of file
+}
+
+// CMessage
+
+CMessage::CMessage(unsigned int oid, SERootObject* root) : Message(oid, root) { } \ No newline at end of file