diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2012-10-21 10:24:15 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2012-10-21 10:24:15 +0000 |
commit | 84fc6ba7d2399bfe5db16c044bace2642f9df8a6 (patch) | |
tree | 5db5b725fb3fbafe16b92f1895727bc77ddeea3c /protocols/Skype/src/skype_subclassing.cpp | |
parent | 68d9f580b716d6ba9103663f3fc1637f41e162fc (diff) |
- added message receiving
git-svn-id: http://svn.miranda-ng.org/main/trunk@2011 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_subclassing.cpp')
-rw-r--r-- | protocols/Skype/src/skype_subclassing.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp index 4a2d9773dd..5409b9a625 100644 --- a/protocols/Skype/src/skype_subclassing.cpp +++ b/protocols/Skype/src/skype_subclassing.cpp @@ -2,6 +2,12 @@ // CSkype +CSkype::CSkype(int num_threads) : Skype(num_threads) +{ + this->proto = NULL; + this->callback == NULL; +} + CAccount* CSkype::newAccount(int oid) { return new CAccount(oid, this); @@ -27,6 +33,25 @@ CContactSearch* CSkype::newContactSearch(int oid) return new CContactSearch(oid, this); } +void CSkype::OnConversationListChange(
+ const ConversationRef &conversation,
+ const Conversation::LIST_TYPE &type,
+ const bool &added)
+{
+ if ((type == Conversation::INBOX_CONVERSATIONS) && (added) && (!inbox.contains(conversation)))
+ {
+ inbox.append(conversation);
+ if (this->proto)
+ (proto->*callback)(conversation->ref());
+ }
+} + +void CSkype::SetOnConversationAddedCallback(OnConversationAdded callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; +} + // CAccount CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) @@ -179,9 +204,35 @@ void CContact::OnChange(int prop) // Conversation -CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) {} +CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) +{ + this->proto = NULL; + this->callback == NULL; +} void CConversation::OnMessage(const MessageRef & message)
{
- // Message handling goes here
+ Message::TYPE messageType;
+ message->GetPropType(messageType);
+
+ if (messageType == Message::POSTED_TEXT)
+ {
+ 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]);
+ }
+ }
+}
+
+void CConversation::SetOnMessageReceivedCallback(OnMessageReceived callback, CSkypeProto* proto)
+{
+ this->proto = proto; + this->callback = callback;
}
\ No newline at end of file |