예제 #1
0
void CSkypeProto::OnContactsSent(const ConversationRef &conversation, const MessageRef &message)
{
	SEString data;

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

	uint timestamp;
	message->GetPropTimestamp(timestamp);

	CMessage::SENDING_STATUS status;
	message->GetPropSendingStatus(status);

	CParticipant::Refs participants;
	conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
	participants[0]->GetPropIdentity(data);
		
	CContact::Ref receiver;
	this->GetContact(data, receiver);

	MCONTACT hContact = this->AddContact(receiver);
	this->SendBroadcast(
		hContact,
		ACKTYPE_CONTACTS,
		status == CMessage::FAILED_TO_SEND ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
		(HANDLE)message->getOID(), 0);
}
예제 #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);
}
예제 #3
0
파일: main.cpp 프로젝트: Uberdust/SkypeDust
void UserConversation::OnMessage(const MessageRef& message){

    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]!="yourusername"){
        
            cout<<"Conversation with:"<<propValues[0]<<endl;
            cout<<"Text: "<<propValues[1]<<endl;
            //Message::Ref reply;
            //this->PostText("Have a reply",reply, false);
        }
    }
}