From 2d1e1839fd95da696e3d19fe3328a0d330137a90 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Wed, 26 Aug 2009 11:50:16 -0400 Subject: [PATCH] [#2006] Fix conferencelist to handle conference_obj_t instead of gchar --- sflphone-client-gnome/src/conference_obj.c | 13 +++++++++ sflphone-client-gnome/src/conference_obj.h | 4 +++ .../src/contacts/conferencelist.c | 28 +++++++++---------- .../src/contacts/conferencelist.h | 16 ++++++----- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/sflphone-client-gnome/src/conference_obj.c b/sflphone-client-gnome/src/conference_obj.c index 677e025517..522570fec5 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 bd22d34046..df19206901 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 5e96ec393d..ac47330795 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 2c6b31f7a4..4836914f7a 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 -- GitLab