Commit d7dbb9b9 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Wrap the conference interface in the C chat room object.

parent 2f74df95
......@@ -223,6 +223,65 @@ LINPHONE_PUBLIC bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr);
*/
LINPHONE_PUBLIC LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *room);
/**
* Add a participant to a chat room. This may fail if this type of chat room does not handle participants.
* Use linphone_chat_room_can_handle_participants() to know if this chat room handles participants.
* @param[in] cr A LinphoneChatRoom object
* @param[in] addr The address of the participant to add to the chat room
* @return The newly added participant or NULL in case of failure
*/
LINPHONE_PUBLIC LinphoneParticipant * linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr);
/**
* Add several participants to a chat room at once. This may fail if this type of chat room does not handle participants.
* Use linphone_chat_room_can_handle_participants() to know if this chat room handles participants.
* @param[in] cr A LinphoneChatRoom object
* @param[in] addresses \bctbx_list{LinphoneAddress}
*/
LINPHONE_PUBLIC void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses);
/**
* Tells whether a chat room is able to handle participants.
* @param[in] cr A LinphoneChatRoom object
* @return A boolean value telling whether the chat room can handle participants or not
*/
LINPHONE_PUBLIC bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr);
/**
* Get the conference ID of the chat room.
* @param[in] cr A LinphoneChatRoom object
* @return The conference ID of the chat room or NULL if this type of chat room is not conference based
*/
LINPHONE_PUBLIC const char * linphone_chat_room_get_id (const LinphoneChatRoom *cr);
/**
* Get the number of participants in the chat room (that is without ourselves).
* @param[in] cr A LinphoneChatRoom object
* @return The number of participants in the chat room
*/
LINPHONE_PUBLIC int linphone_chat_room_get_nb_participants (const LinphoneChatRoom *cr);
/**
* Get the list of participants of a chat room.
* @param[in] cr A LinphoneChatRoom object
* @return \bctbx_list{LinphoneParticipant}
*/
LINPHONE_PUBLIC bctbx_list_t * linphone_chat_room_get_participants (const LinphoneChatRoom *cr);
/**
* Remove a participant of a chat room.
* @param[in] cr A LinphoneChatRoom object
* @param[in] participant The participant to remove from the chat room
*/
LINPHONE_PUBLIC void linphone_chat_room_remove_participant (LinphoneChatRoom *cr, LinphoneParticipant *participant);
/**
* Remove several participants of a chat room at once.
* @param[in] cr A LinphoneChatRoom object
* @param[in] participants \bctbx_list{LinphoneParticipant}
*/
LINPHONE_PUBLIC void linphone_chat_room_remove_participants (LinphoneChatRoom *cr, const bctbx_list_t *participants);
/**
* Returns back pointer to #LinphoneCore object.
* @deprecated use linphone_chat_room_get_core()
......
......@@ -81,6 +81,11 @@ typedef struct _LinphoneConferenceParticipantEvent LinphoneConferenceParticipant
typedef struct _LinphoneEventLog LinphoneEventLog;
typedef struct _LinphoneMessage LinphoneMessage;
typedef struct _LinphoneMessageEvent LinphoneMessageEvent;
/**
* The LinphoneParticipant object represents a participant of a conference.
* @ingroup misc
**/
typedef struct _LinphoneParticipant LinphoneParticipant;
// =============================================================================
......
......@@ -35,6 +35,8 @@ using namespace std;
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatRoom, ChatRoom)
extern LinphoneParticipant * _linphone_participant_init();
static void _linphone_chat_room_constructor(LinphoneChatRoom *cr);
static void _linphone_chat_room_destructor(LinphoneChatRoom *cr);
......@@ -187,6 +189,41 @@ LinphoneChatMessage * linphone_chat_room_find_message(LinphoneChatRoom *cr, cons
return GET_CPP_PTR(cr)->findMessage(message_id);
}
LinphoneParticipant * linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
return L_GET_C_BACK_PTR(GET_CPP_PTR(cr)->addParticipant(
*L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address), nullptr, false),
Participant, participant);
}
void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
GET_CPP_PTR(cr)->addParticipants(L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(addresses, Address, Address), nullptr, false);
}
bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) {
return GET_CPP_PTR(cr)->canHandleParticipants();
}
const char * linphone_chat_room_get_id (const LinphoneChatRoom *cr) {
string id = GET_CPP_PTR(cr)->getId();
return id.empty() ? nullptr : id.c_str();
}
int linphone_chat_room_get_nb_participants (const LinphoneChatRoom *cr) {
return GET_CPP_PTR(cr)->getNbParticipants();
}
bctbx_list_t * linphone_chat_room_get_participants (const LinphoneChatRoom *cr) {
return L_GET_C_LIST_OF_STRUCT_PTR_FROM_CPP_LIST_OF_CPP_OBJ(GET_CPP_PTR(cr)->getParticipants(), Participant, Participant, participant);
}
void linphone_chat_room_remove_participant (LinphoneChatRoom *cr, LinphoneParticipant *participant) {
GET_CPP_PTR(cr)->removeParticipant(L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant));
}
void linphone_chat_room_remove_participants (LinphoneChatRoom *cr, const bctbx_list_t *participants) {
GET_CPP_PTR(cr)->removeParticipants(L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(participants, Participant, Participant));
}
/*******************************************************************************
* Reference and user data handling functions *
......
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