diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2012-12-19 11:30:59 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2012-12-19 11:30:59 +0000 |
commit | a597717faf025d280206a03b582057b45c4b6f9f (patch) | |
tree | 31fb8fbe332e88e848f36c9663f9fd024c19738a /protocols/Skype/src/skype_events.cpp | |
parent | dda548686c0f8b0d0bf03315120132013ffa1bb0 (diff) |
- second approach of group chat support
git-svn-id: http://svn.miranda-ng.org/main/trunk@2766 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_events.cpp')
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 79 |
1 files changed, 52 insertions, 27 deletions
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 8ceb136173..a3a89b9a6e 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -2,7 +2,8 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
{
- this->RegisterChat();
+ this->InitChat();
+
this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
this->HookEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit);
@@ -28,10 +29,10 @@ int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message)
{
- uint timestamp;
- message->GetPropTimestamp(timestamp);
+ SEString data;
- SEString data;
+ uint timestamp;
+ message->GetPropTimestamp(timestamp);
message->GetPropAuthor(data);
char *sid = ::mir_strdup((const char*)data);
@@ -39,43 +40,67 @@ void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message->GetPropBodyXml(data);
char *text = ::mir_strdup((const char*)data);
- Participant::Refs participants;
- conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
+ CConversation::TYPE type;
+ conversation->GetPropType(type);
+ if (type == CConversation::DIALOG)
+ {
+ CParticipant::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);
+ 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);
+ }
+ }
+ else
+ {
+ conversation->GetPropIdentity(data);
+ char *chatID = ::mir_utf8encode((const char*)data);
+
+ this->ChatEvent(chatID, sid, /*GC_EVENT_MESSAGE*/0x0040, text);
}
}
void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message)
{
+ SEString data;
+
uint timestamp;
message->GetPropTimestamp(timestamp);
- SEString data;
-
message->GetPropAuthor(data);
char *sid = ::mir_strdup((const char*)data);
+
+ message->GetPropBodyXml(data);
+ char *text = ::mir_utf8decodeA((const char*)data);
- message->GetPropAuthorDisplayname(data);
- char *nick = ::mir_strdup((const char*)data);
+ CConversation::TYPE type;
+ conversation->GetPropType(type);
+ if (type == CConversation::DIALOG)
+ {
+ 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);
+ }
+ else
+ {
+ conversation->GetPropIdentity(data);
+ char *chatID = ::mir_strdup((const char*)data);
- this->RaiseMessageReceivedEvent(
- (DWORD)timestamp,
- sid,
- nick,
- text);
+ this->ChatEvent(chatID, sid, /*GC_EVENT_MESSAGE*/ 0x0040, text);
+ }
/*const char *msg = (const char*)propValues[2];
int len = ::strlen(msg) + 8;
|