/*
 * Copyright (c) 2022 Belledonne Communications SARL.
 *
 * This file is part of linphone-desktop
 * (see https://www.linphone.org).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef FRIEND_LIST_LISTENER_H_
#define FRIEND_LIST_LISTENER_H_


#include <linphone++/linphone.hh>

#include <QObject>

// =============================================================================

class FriendListListener : public QObject, public linphone::FriendListListener {
    Q_OBJECT
	
public:
    FriendListListener (QObject *parent = nullptr);
    virtual void onContactCreated(const std::shared_ptr<linphone::FriendList> & friendList, const std::shared_ptr<linphone::Friend> & linphoneFriend) override;
	virtual void onContactDeleted(const std::shared_ptr<linphone::FriendList> & friendList, const std::shared_ptr<linphone::Friend> & linphoneFriend) override;
	virtual void onContactUpdated(const std::shared_ptr<linphone::FriendList> & friendList, const std::shared_ptr<linphone::Friend> & newFriend, const std::shared_ptr<linphone::Friend> & oldFriend) override;
	virtual void onSyncStatusChanged(const std::shared_ptr<linphone::FriendList> & friendList, linphone::FriendList::SyncStatus status, const std::string & message) override;
	virtual void onPresenceReceived(const std::shared_ptr<linphone::FriendList> & friendList, const std::list<std::shared_ptr<linphone::Friend>> & friends) override;
		
signals:
	void contactCreated(const std::shared_ptr<linphone::Friend> & linphoneFriend);
	void contactDeleted(const std::shared_ptr<linphone::Friend> & linphoneFriend);
	void contactUpdated(const std::shared_ptr<linphone::Friend> & newFriend, const std::shared_ptr<linphone::Friend> & oldFriend);
	void syncStatusChanged(linphone::FriendList::SyncStatus status, const std::string & message);
	void presenceReceived(const std::list<std::shared_ptr<linphone::Friend>> & friends);
};

#endif
