diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/Skype/src/skype_account.cpp | 4 | ||||
| -rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 19 | ||||
| -rw-r--r-- | protocols/Skype/src/skype_database.cpp | 36 | ||||
| -rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 10 | ||||
| -rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 25 | ||||
| -rw-r--r-- | protocols/Skype/src/skype_proto.h | 1 | ||||
| -rw-r--r-- | protocols/Skype/src/skypekit/account.cpp | 7 | ||||
| -rw-r--r-- | protocols/Skype/src/skypekit/account.h | 1 | ||||
| -rw-r--r-- | protocols/Skype/src/skypekit/conversation.cpp | 2 | 
9 files changed, 63 insertions, 42 deletions
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index 5fd173ef1b..7396785e7a 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -223,7 +223,7 @@ void CSkypeProto::OnLoggedIn()  	this->LoadOwnInfo(this);
  	this->LoadChatList(this);
 -	this->LoadContactList(this);
 +	this->LoadContactList(reinterpret_cast<void *>(static_cast<int>(true)));
  	this->LoadAuthWaitList(this);
 @@ -235,7 +235,7 @@ void CSkypeProto::OnLoggedIn()  void CSkypeProto::OnCblUpdated()
  {
  	// reload our CL after skype CL fully synced
 -	this->LoadContactList(this);
 +	this->LoadContactList(reinterpret_cast<void *>(static_cast<int>(false)));
  	this->LoadAuthWaitList(this);
  }
 diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index a4f9b0bb16..221e1f7669 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -224,6 +224,7 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact)  		::db_set_ws(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN, sid);
  		::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
 +
  		DBVARIANT dbv;
  		if(!db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv))
  		{
 @@ -239,8 +240,10 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact)  	return hContact;
  }
 -void __cdecl CSkypeProto::LoadContactList(void*)
 +void __cdecl CSkypeProto::LoadContactList(void* data)
  {
 +	bool isFirstLoad = data != NULL;
 +
  	g_skype->GetHardwiredContactGroup(CContactGroup::ALL_BUDDIES, this->commonList);
  	this->commonList.fetch();
  	this->commonList->SetOnContactListChangedCallback(
 @@ -258,11 +261,15 @@ void __cdecl CSkypeProto::LoadContactList(void*)  		HANDLE hContact = this->AddContact(contact);
 -		// todo: move to AddContact?
 -		this->UpdateContactAuthState(hContact, contact);
 -		this->UpdateContactStatus(hContact, contact);
 -
 -		this->UpdateProfile(contact.fetch(), hContact);
 +		if ( !isFirstLoad)
 +		{
 +			// todo: move to AddContact?
 +			this->UpdateContactAuthState(hContact, contact);
 +			this->UpdateContactStatus(hContact, contact);
 +			
 +			this->UpdateProfileNickName(contact.fetch(), hContact);
 +			this->UpdateProfile(contact.fetch(), hContact);
 +		}
  	}
  }
 diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 4eb92678d7..258b629781 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -12,11 +12,11 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* gu  		dbei.pBlob = (PBYTE)::mir_alloc(dbei.cbBlob);
  		::db_event_get(hDbEvent, &dbei);
 -		/*if (dbei.timestamp < timestamp)
 +		if (dbei.timestamp < timestamp)
  		{
  			::mir_free(dbei.pBlob);
  			break;
 -		}*/
 +		}
  		int sendFlag = dbei.flags & DBEF_SENT;
  		if (dbei.eventType == EVENTTYPE_MESSAGE && sendFlag == flag)
 @@ -93,9 +93,9 @@ void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact)  void CSkypeProto::RaiseMessageReceivedEvent(HANDLE hContact, DWORD timestamp, const char *guid, const wchar_t *message, bool isNeedCheck)
  {
 -	//if (isNeedCheck)
 -	//	if (this->IsMessageInDB(hContact, timestamp, guid))
 -	//		return;
 +	if (isNeedCheck)
 +		if (this->IsMessageInDB(hContact, timestamp, guid))
 +			return;
  	PROTORECVEVENT recv;
  	recv.flags = PREF_UTF;
 @@ -108,8 +108,8 @@ void CSkypeProto::RaiseMessageReceivedEvent(HANDLE hContact, DWORD timestamp, co  void CSkypeProto::RaiseMessageSendedEvent(HANDLE hContact, DWORD timestamp, const char *guid, const wchar_t *message)
  {
 -	//if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT))
 -	//	return;
 +	if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT))
 +		return;
  	char *msg = ::mir_utf8encodeW(message);
 @@ -123,24 +123,4 @@ void CSkypeProto::RaiseMessageSendedEvent(HANDLE hContact, DWORD timestamp, cons  	dbei.flags = PREF_UTF | DBEF_SENT;
  	::db_event_add(hContact, &dbei);
 -}
 -
 -//void CSkypeProto::RaiseFileReceivedEvent(
 -//	DWORD timestamp,
 -//	const char* sid, 
 -//	const char* nick, 
 -//	const char* message)
 -//{	
 -//	PROTORECVFILET pre = {0};
 -//
 -//	CCSDATA ccs = {0};
 -//	ccs.szProtoService = PSR_FILE;
 -//	ccs.hContact = this->AddContactBySid(sid, nick);
 -//	ccs.wParam = 0;
 -//	ccs.lParam = (LPARAM)⪯
 -//	pre.flags = PREF_UTF;
 -//	pre.timestamp = timestamp;
 -//	//pre.szMessage = (char *)message;
 -//	
 -//	::CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
 -//}
\ No newline at end of file +}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index 412a6fc04c..65eea35410 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -263,6 +263,14 @@ void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact)  	::mir_free(phone);
  }
 +void CSkypeProto::UpdateProfileNickName(SEObject *obj, HANDLE hContact)
 +{
 +	wchar_t *nick = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_DISPLAYNAME */ 21));
 +	if (::wcslen(nick))
 +		::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
 +	::mir_free(nick);
 +}
 +
  void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact)
  {
  	wchar_t* phone = ::mir_a2u(obj->GetStrProp(/* *::P_PHONE_HOME */ 13));
 @@ -335,7 +343,7 @@ void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact)  void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact)
  {
 -	this->UpdateProfileAvatar(obj, hContact);	
 +	this->UpdateProfileAvatar(obj, hContact);
  	uint newTS = obj->GetUintProp(/* *::P_PROFILE_TIMESTAMP */ 19);
  	if (newTS > ::db_get_dw(hContact, this->m_szModuleName, "ProfileTS", 0))
 diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 49ca34ba61..ac28c0a6e2 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -282,11 +282,26 @@ int    __cdecl CSkypeProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre)  	::db_unset(hContact, "CList", "Hidden");
  	this->UserIsTyping(hContact, PROTOTYPE_SELFTYPING_OFF);
 -	/*int length = ::strlen(pre->szMessage) + 1;
 -	pre->szMessage = (char *)::mir_realloc(pre->szMessage, length + 32);
 -	::memcpy(&pre->szMessage[length], (char *)pre->lParam, 32);*/
 +	DBEVENTINFO dbei = { 0 };
 +	dbei.cbSize = sizeof(dbei);
 +	dbei.szModule = GetContactProto(hContact);
 +	dbei.timestamp = pre->timestamp;
 +	dbei.eventType = EVENTTYPE_MESSAGE;
 +	dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
 +	dbei.pBlob = (PBYTE) pre->szMessage;
 +
 +	char *guid = (char *)pre->lParam;
 +	dbei.pBlob = (PBYTE)::mir_realloc(dbei.pBlob, dbei.cbBlob + 32);
 +	::memcpy((char *)&dbei.pBlob[dbei.cbBlob], guid, 32);
 +
 +	if (pre->flags & PREF_CREATEREAD)
 +		dbei.flags |= DBEF_READ;
 +	if (pre->flags & PREF_UTF)
 +		dbei.flags |= DBEF_UTF;
 +
 +	return (INT_PTR)::db_event_add(hContact, &dbei);
 -	return ::Proto_RecvMessage(hContact, pre);
 +	//return ::Proto_RecvMessage(hContact, pre);
  }
  int    __cdecl CSkypeProto::RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
 @@ -395,7 +410,7 @@ int CSkypeProto::SetStatus(int new_status)  		}
  		else
  		{
 -			if (this->m_iStatus == ID_STATUS_CONNECTING) 
 +			if ( !this->account->IsOnline()) 
  				return 0;
  			CContact::AVAILABILITY availability = this->MirandaToSkypeStatus(new_status);
 diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index c57c4f0858..a93101c926 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -379,6 +379,7 @@ protected:  	void	UpdateProfileHomepage(SEObject *obj, HANDLE hContact = NULL);
  	void	UpdateProfileLanguages(SEObject *obj, HANDLE hContact = NULL);
  	void	UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact = NULL);
 +	void	UpdateProfileNickName(SEObject *obj, HANDLE hContact = NULL);
  	void	UpdateProfilePhone(SEObject *obj, HANDLE hContact = NULL);
  	void	UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact = NULL);
  	void	UpdateProfileState(SEObject *obj, HANDLE hContact = NULL);
 diff --git a/protocols/Skype/src/skypekit/account.cpp b/protocols/Skype/src/skypekit/account.cpp index 31b4c45298..fa931d179e 100644 --- a/protocols/Skype/src/skypekit/account.cpp +++ b/protocols/Skype/src/skypekit/account.cpp @@ -15,6 +15,13 @@ void CAccount::SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProt  	this->callback = callback;
  }
 +bool CAccount::IsOnline()
 +{
 +	CAccount::STATUS status;
 +	this->GetPropStatus(status);
 +	return status == CAccount::LOGGED_IN;
 +}
 +
  bool CAccount::SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result)
  {
  	int fbl;
 diff --git a/protocols/Skype/src/skypekit/account.h b/protocols/Skype/src/skypekit/account.h index b537019698..07ff0b929c 100644 --- a/protocols/Skype/src/skypekit/account.h +++ b/protocols/Skype/src/skypekit/account.h @@ -14,6 +14,7 @@ public:  	CAccount(unsigned int oid, SERootObject* root);
 +	bool IsOnline();
  	bool SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result);
  	void SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto);
 diff --git a/protocols/Skype/src/skypekit/conversation.cpp b/protocols/Skype/src/skypekit/conversation.cpp index c0d855150b..2b0e26ad80 100644 --- a/protocols/Skype/src/skypekit/conversation.cpp +++ b/protocols/Skype/src/skypekit/conversation.cpp @@ -2,6 +2,8 @@  CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root)
  {
 +	this->GetParticipants(this->participants, CConversation::OTHER_CONSUMERS);
 +	fetch(this->participants);
  }
  void CConversation::OnParticipantListChange()
  | 
