Exemplo n.º 1
0
void CSkypeProto::OnContactsEvent(const ConversationRef &conversation, const MessageRef &message)
{
	SEString author;
	message->GetPropAuthor(author);
			
	if (::wcsicmp(mir_ptr<wchar_t>(::mir_utf8decodeW(author)), this->login) == 0)
		this->OnContactsSent(conversation, message);
	else
		this->OnContactsReceived(conversation, message);
}
Exemplo n.º 2
0
void CSkypeProto::OnContactsReceived(const ConversationRef &conversation, const MessageRef &message)
{
	CContact::Refs contacts;
	message->GetContacts(contacts);

	uint timestamp;
	message->GetPropTimestamp(timestamp);

	CMessage::TYPE messageType;
	message->GetPropType(messageType);

	SEString data;
	message->GetPropAuthor(data);			
		
	CContact::Ref author;
	this->GetContact(data, author);

	MCONTACT hContact = this->AddContact(author);

	SEBinary guid;
	message->GetPropGuid(guid);
	ReadMessageParam param = { guid, messageType };

	PROTORECVEVENT pre = { 0 };
	pre.flags = PREF_UTF;
	pre.lParam = (LPARAM)&param;
	pre.timestamp = timestamp;

	int msgSize = 1;
	pre.szMessage = (char *)::mir_alloc(msgSize);
	pre.szMessage[0] = 0;

	int len = 0;
	char* pCur = &pre.szMessage[0];

	for (size_t i = 0; i < contacts.size(); i ++)
	{
		contacts[i]->GetIdentity(data);
		if ( ::lstrcmpi(mir_ptr<wchar_t>(::mir_utf8decodeW(data)), this->login) != 0)
			this->AddContact(contacts[i]);
	}

	char *text = ::mir_utf8encode(::Translate("Contacts received"));

	this->AddDBEvent(
		hContact,
		SKYPE_DB_EVENT_TYPE_CONTACTS,
		timestamp,
		PREF_UTF,
		(DWORD)::strlen(text) + 1,
		(PBYTE)text);
}
Exemplo n.º 3
0
Poco::SharedPtr<MessageData> Util::dataFromMessage(const MessageRef &message)
{
    int messageType = message->GetProp(Message::P_TYPE).toInt();

    SEString author;
    SEString authorName;
    SEString bodyXmlString;
    unsigned int timeStamp;
    message->GetPropAuthor(author);
    message->GetPropAuthorDisplayname(authorName);
    message->GetPropBodyXml(bodyXmlString);
    message->GetPropTimestamp(timeStamp);

    Poco::SharedPtr<MessageData> data = new MessageData;
    data->author = author.data();
    data->authorDisplayname = authorName.data();
    data->body = bodyXmlString.data();
    data->timestamp = timeStamp;
    data->isEmote = (messageType == Message::POSTED_EMOTE);

    return data;
}