diff --git a/sflphone-client-gnome/src/conference_obj.c b/sflphone-client-gnome/src/conference_obj.c index 677e025517cef403e4026e06e38dbddb30cd2149..522570fec531ee3df1f0827e8172d98c97b9b349 100644 --- a/sflphone-client-gnome/src/conference_obj.c +++ b/sflphone-client-gnome/src/conference_obj.c @@ -21,6 +21,19 @@ #include <sflphone_const.h> #include <time.h> +gint is_confID_confstruct ( gconstpointer a, gconstpointer b) +{ + conference_obj_t * c = (conference_obj_t*)a; + if(g_strcasecmp(c->_confID, (const gchar*) b) == 0) + { + return 0; + } + else + { + return 1; + } +} + void create_new_conference (conference_state_t state, gchar* confID, conference_obj_t ** new_conf) { diff --git a/sflphone-client-gnome/src/conference_obj.h b/sflphone-client-gnome/src/conference_obj.h index bd22d34046aadbc15cf824777ca0c23e145973e6..df1920690191432b61b56496805023645d158d01 100644 --- a/sflphone-client-gnome/src/conference_obj.h +++ b/sflphone-client-gnome/src/conference_obj.h @@ -54,5 +54,9 @@ void create_new_conference_from_details (const gchar *, GHashTable *, conference void free_conference_obj_t (conference_obj_t *c); +/* + * GCompareFunc to compare a confID (gchar* and a callable_obj_t) + */ +gint is_confID_confstruct ( gconstpointer, gconstpointer); #endif diff --git a/sflphone-client-gnome/src/contacts/conferencelist.c b/sflphone-client-gnome/src/contacts/conferencelist.c index 5e96ec393d79b5afd115a949167ee4fe3fdfe9cd..ac47330795dbe1e0f9a6ccad28bfd52915851edd 100644 --- a/sflphone-client-gnome/src/contacts/conferencelist.c +++ b/sflphone-client-gnome/src/contacts/conferencelist.c @@ -54,34 +54,34 @@ conferencelist_reset() void -conferencelist_add(const gchar* conf_id) +conferencelist_add(const conference_obj_t* conf) { - gchar* c = (gchar*)conferencelist_get(conf_id); + gchar* c = (gchar*)conferencelist_get(conf); if(!c) { - g_print("Conference id(s): %s\n", conf_id); - g_queue_push_tail (conferenceQueue, (gpointer)conf_id); + g_print("Conference id(s): %s\n", conf->_confID); + g_queue_push_tail (conferenceQueue, (gpointer)conf); } } void -conferencelist_remove (const gchar* conf_id) +conferencelist_remove (const gchar* conf) { - gchar* c = (gchar*)conferencelist_get(conf_id); + gchar* c = (gchar*)conferencelist_get(conf); if (c) { g_queue_remove(conferenceQueue, c); } } -gchar* -conferencelist_get (const gchar* conf_id) +conference_obj_t* +conferencelist_get (const gchar* conf) { - GList* c = g_queue_find(conferenceQueue, conf_id); + GList* c = g_queue_find_custom(conferenceQueue, conf, is_confID_confstruct); if (c) { - return (gchar *)c->data; + return (conference_obj_t*)c->data; } else { @@ -90,13 +90,13 @@ conferencelist_get (const gchar* conf_id) } -gchar* -conferencelist_get_nth (const gchar* conf_id, guint n ) +conference_obj_t* +conferencelist_get_nth ( guint n ) { GList* c = g_queue_peek_nth(conferenceQueue, n); if (c) { - return (gchar*)c->data; + return (conference_obj_t*)c->data; } else { @@ -106,7 +106,7 @@ conferencelist_get_nth (const gchar* conf_id, guint n ) guint -conferencelist_get_size (const gchar* conf_id) +conferencelist_get_size () { return g_queue_get_length (conferenceQueue); } diff --git a/sflphone-client-gnome/src/contacts/conferencelist.h b/sflphone-client-gnome/src/contacts/conferencelist.h index 2c6b31f7a45d62b8631aa76516e54c2db02acd37..4836914f7a36008731935531366542eb2c1ce6f2 100644 --- a/sflphone-client-gnome/src/contacts/conferencelist.h +++ b/sflphone-client-gnome/src/contacts/conferencelist.h @@ -20,6 +20,8 @@ #ifndef __CONFERENCELIST_H__ #define __CONFERENCELIST_H__ + +#include <conference_obj.h> #include <gtk/gtk.h> /** @file conferencelist.h @@ -44,30 +46,30 @@ conferencelist_reset (); * @param conf The conference you want to add * */ void -conferencelist_add (const gchar* conf_id); +conferencelist_add (const conference_obj_t* conf); /** This function remove a conference from list. * @param callID The callID of the conference you want to remove */ void -conferencelist_remove (const gchar* conf_id); +conferencelist_remove (const gchar* conf); /** Return the number of calls in the list * @return The number of calls in the list */ guint -conferencelist_get_size (const gchar* conf_id); +conferencelist_get_size (); /** Return the call at the nth position in the list * @param n The position of the call you want * @return A call or NULL */ -gchar* -conferencelist_get_nth (const gchar* conf_id, guint n ); +conference_obj_t* +conferencelist_get_nth (guint n ); /** Return the call corresponding to the callID * @param n The callID of the call you want * @return A call or NULL */ -gchar* -conferencelist_get (const gchar* conf_id); +conference_obj_t* +conferencelist_get (const gchar* conf); #endif