Commit 231f0e39 authored by Ghislain MARY's avatar Ghislain MARY

Add callback on chat room subject change.

parent b5e01655
......@@ -183,6 +183,13 @@ typedef void (*LinphoneChatRoomCbsParticipantAdminStatusChangedCb) (LinphoneChat
*/
typedef void (*LinphoneChatRoomCbsStateChangedCb) (LinphoneChatRoom *cr, LinphoneChatRoomState newState);
/**
* Callback used to notify that the subject of a chat room has changed.
* @param[in] cr #LinphoneChatRoom object
* @param[in] subject The new subject of the chat room
*/
typedef void (*LinphoneChatRoomCbsSubjectChangedCb) (LinphoneChatRoom *cr, const char *subject);
/**
* Callback used to notify a chat room that a message has been received but we were unable to decrypt it
* @param cr #LinphoneChatRoom involved in this conversation
......
......@@ -144,6 +144,20 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsStateChangedCb linphone_chat_room_cbs_get_sta
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_state_changed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsStateChangedCb cb);
/**
* Get the subject changed callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current subject changed callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsSubjectChangedCb linphone_chat_room_cbs_get_subject_changed (const LinphoneChatRoomCbs *cbs);
/**
* Set the subject changed callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The subject changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_subject_changed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSubjectChangedCb cb);
/**
* Get the undecryptable message received callback.
* @param[in] cbs LinphoneChatRoomCbs object.
......
......@@ -31,6 +31,7 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsParticipantRemovedCb participantRemovedCb;
LinphoneChatRoomCbsParticipantAdminStatusChangedCb participantAdminStatusChangedCb;
LinphoneChatRoomCbsStateChangedCb stateChangedCb;
LinphoneChatRoomCbsSubjectChangedCb subjectChangedCb;
LinphoneChatRoomCbsUndecryptableMessageReceivedCb undecryptableMessageReceivedCb;
};
......@@ -116,6 +117,14 @@ void linphone_chat_room_cbs_set_state_changed (LinphoneChatRoomCbs *cbs, Linphon
cbs->stateChangedCb = cb;
}
LinphoneChatRoomCbsSubjectChangedCb linphone_chat_room_cbs_get_subject_changed (const LinphoneChatRoomCbs *cbs) {
return cbs->subjectChangedCb;
}
void linphone_chat_room_cbs_set_subject_changed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSubjectChangedCb cb) {
cbs->subjectChangedCb = cb;
}
LinphoneChatRoomCbsUndecryptableMessageReceivedCb linphone_chat_room_cbs_get_undecryptable_message_received (const LinphoneChatRoomCbs *cbs) {
return cbs->undecryptableMessageReceivedCb;
}
......
......@@ -184,6 +184,15 @@ void ClientGroupChatRoom::onParticipantSetAdmin (const Address &addr, bool isAdm
cb(cr, L_GET_C_BACK_PTR(participant), isAdmin);
}
void ClientGroupChatRoom::onSubjectChanged (const std::string &subject) {
this->subject = subject;
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsSubjectChangedCb cb = linphone_chat_room_cbs_get_subject_changed(cbs);
if (cb)
cb(cr, subject.c_str());
}
// -----------------------------------------------------------------------------
void ClientGroupChatRoom::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const string &message) {
......
......@@ -59,6 +59,7 @@ private:
void onParticipantAdded (const Address &addr) override;
void onParticipantRemoved (const Address &addr) override;
void onParticipantSetAdmin (const Address &addr, bool isAdmin) override;
void onSubjectChanged (const std::string &subject) override;
private:
/* CallSessionListener */
......
......@@ -32,6 +32,7 @@ public:
virtual void onParticipantAdded (const Address &addr) = 0;
virtual void onParticipantRemoved (const Address &addr) = 0;
virtual void onParticipantSetAdmin (const Address &addr, bool isAdmin) = 0;
virtual void onSubjectChanged (const std::string &subject) = 0;
};
LINPHONE_END_NAMESPACE
......
......@@ -92,4 +92,6 @@ void RemoteConference::onParticipantRemoved (const Address &addr) {}
void RemoteConference::onParticipantSetAdmin (const Address &addr, bool isAdmin) {}
void RemoteConference::onSubjectChanged (const std::string &subject) {}
LINPHONE_END_NAMESPACE
......@@ -48,6 +48,7 @@ protected:
void onParticipantAdded (const Address &addr) override;
void onParticipantRemoved (const Address &addr) override;
void onParticipantSetAdmin (const Address &addr, bool isAdmin) override;
void onSubjectChanged (const std::string &subject) override;
protected:
RemoteConferenceEventHandler *eventHandler = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment