Skip to content
Snippets Groups Projects
Commit 2d1e1839 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2006] Fix conferencelist to handle conference_obj_t instead of gchar

parent 4daeb9ce
Branches
Tags
No related merge requests found
...@@ -21,6 +21,19 @@ ...@@ -21,6 +21,19 @@
#include <sflphone_const.h> #include <sflphone_const.h>
#include <time.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) void create_new_conference (conference_state_t state, gchar* confID, conference_obj_t ** new_conf)
{ {
......
...@@ -54,5 +54,9 @@ void create_new_conference_from_details (const gchar *, GHashTable *, conference ...@@ -54,5 +54,9 @@ void create_new_conference_from_details (const gchar *, GHashTable *, conference
void free_conference_obj_t (conference_obj_t *c); 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 #endif
...@@ -54,34 +54,34 @@ conferencelist_reset() ...@@ -54,34 +54,34 @@ conferencelist_reset()
void 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) if(!c)
{ {
g_print("Conference id(s): %s\n", conf_id); g_print("Conference id(s): %s\n", conf->_confID);
g_queue_push_tail (conferenceQueue, (gpointer)conf_id); g_queue_push_tail (conferenceQueue, (gpointer)conf);
} }
} }
void 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) if (c)
{ {
g_queue_remove(conferenceQueue, c); g_queue_remove(conferenceQueue, c);
} }
} }
gchar* conference_obj_t*
conferencelist_get (const gchar* conf_id) 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) if (c)
{ {
return (gchar *)c->data; return (conference_obj_t*)c->data;
} }
else else
{ {
...@@ -90,13 +90,13 @@ conferencelist_get (const gchar* conf_id) ...@@ -90,13 +90,13 @@ conferencelist_get (const gchar* conf_id)
} }
gchar* conference_obj_t*
conferencelist_get_nth (const gchar* conf_id, guint n ) conferencelist_get_nth ( guint n )
{ {
GList* c = g_queue_peek_nth(conferenceQueue, n); GList* c = g_queue_peek_nth(conferenceQueue, n);
if (c) if (c)
{ {
return (gchar*)c->data; return (conference_obj_t*)c->data;
} }
else else
{ {
...@@ -106,7 +106,7 @@ conferencelist_get_nth (const gchar* conf_id, guint n ) ...@@ -106,7 +106,7 @@ conferencelist_get_nth (const gchar* conf_id, guint n )
guint guint
conferencelist_get_size (const gchar* conf_id) conferencelist_get_size ()
{ {
return g_queue_get_length (conferenceQueue); return g_queue_get_length (conferenceQueue);
} }
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#ifndef __CONFERENCELIST_H__ #ifndef __CONFERENCELIST_H__
#define __CONFERENCELIST_H__ #define __CONFERENCELIST_H__
#include <conference_obj.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
/** @file conferencelist.h /** @file conferencelist.h
...@@ -44,30 +46,30 @@ conferencelist_reset (); ...@@ -44,30 +46,30 @@ conferencelist_reset ();
* @param conf The conference you want to add * @param conf The conference you want to add
* */ * */
void void
conferencelist_add (const gchar* conf_id); conferencelist_add (const conference_obj_t* conf);
/** This function remove a conference from list. /** This function remove a conference from list.
* @param callID The callID of the conference you want to remove * @param callID The callID of the conference you want to remove
*/ */
void 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
* @return The number of calls in the list */ * @return The number of calls in the list */
guint guint
conferencelist_get_size (const gchar* conf_id); conferencelist_get_size ();
/** Return the call at the nth position in the list /** Return the call at the nth position in the list
* @param n The position of the call you want * @param n The position of the call you want
* @return A call or NULL */ * @return A call or NULL */
gchar* conference_obj_t*
conferencelist_get_nth (const gchar* conf_id, guint n ); conferencelist_get_nth (guint n );
/** Return the call corresponding to the callID /** Return the call corresponding to the callID
* @param n The callID of the call you want * @param n The callID of the call you want
* @return A call or NULL */ * @return A call or NULL */
gchar* conference_obj_t*
conferencelist_get (const gchar* conf_id); conferencelist_get (const gchar* conf);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment