diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index efc2508b2899b524b8d1ffad9a372fb009bfbe4c..b8eb4ba5c735653de945e512c5245284f6e49a6c 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -1275,6 +1275,7 @@ void sflphone_fill_history (void) gpointer key, value; gpointer key_to_min = NULL; callable_obj_t *history_entry; + conference_obj_t *conference_entry; int timestamp = 0; int min_timestamp = 0; @@ -1317,16 +1318,30 @@ void sflphone_fill_history (void) if (g_hash_table_lookup_extended (entries, key_to_min, &key, &value)) { - // do something with key and value - create_history_entry_from_serialized_form ( (gchar*) key, (gchar*) value, &history_entry); - DEBUG ("SFLphone: History timestart%d\n", history_entry->_time_start); - - // Add it and update the GUI - calllist_add_call (history, history_entry); - calltree_add_call (history, history_entry, NULL); + gchar **ptr; + const gchar *delim = "|"; + + DEBUG("---------------------------------- HISTORY VALUE %s", value); - // remove entry from map - g_hash_table_remove (entries, key_to_min); + ptr = g_strsplit(value, delim, 6); + if(ptr != NULL) { + + // first ptr refers to entry type + if(g_strcmp0(*ptr, "2188") == 0) { + // create_conference_history_entry_from_serialized((gchar *)key, (gchar **)ptr, &conference_entry); + g_hash_table_remove(entries, key_to_min); + } + else { + // do something with key and value + create_history_entry_from_serialized_form ( (gchar*) key, (gchar **) ptr, &history_entry); + + // Add it and update the GUI + calllist_add_call (history, history_entry); + calltree_add_call (history, history_entry, NULL); + // remove entry from map + g_hash_table_remove (entries, key_to_min); + } + } } } } diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index acb9b80b1504a3cc713dcb41a22bd6236dc1ab0c..df20980b58a6756473367ea16c07eef2b6086843 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -298,55 +298,50 @@ void create_new_call_from_details (const gchar *call_id, GHashTable *details, ca *call = new_call; } -void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details, callable_obj_t **call) +void create_history_entry_from_serialized_form (gchar *timestamp, gchar **ptr, callable_obj_t **call) { - gchar *peer_name=""; - gchar *peer_number="", *accountID="", *time_stop=""; - gchar *recordfile=""; + gchar *peer_name = ""; + gchar *peer_number = "", *accountID = "", *time_stop = ""; + gchar *recordfile = ""; callable_obj_t *new_call; history_state_t history_state = MISSED; - char **ptr; - const char *delim="|"; - int token=0; + const gchar *delim = "|"; + gint token = 0; // details is in serialized form, i e: calltype%to%from%callid - if ( (ptr = g_strsplit (details, delim, 6)) != NULL) { - - while (ptr != NULL && token < 6) { - switch (token) { - case 0: - DEBUG("------------------------------------------------------------------------------------------ HISTORYSTATE FROM SERIALIZATION %s", *ptr); - history_state = get_history_state_from_id (*ptr); - break; - case 1: - DEBUG("------------------------------------------------------------------------------------------ PEERNUMBER FROM SERIALIZATION %s", *ptr); - peer_number = *ptr; - break; - case 2: - DEBUG("------------------------------------------------------------------------------------------ PEERNAME FROM SERIALIZATION %s", *ptr); - peer_name = *ptr; - break; - case 3: - DEBUG("------------------------------------------------------------------------------------------ TIMESTOP FROM SERIALIZATION %s", *ptr); - time_stop = *ptr; - break; - case 4: - DEBUG("------------------------------------------------------------------------------------------ ACCOUNTID FROM SERIALIZATION %s", *ptr); - accountID = *ptr; - break; - case 5: - DEBUG("------------------------------------------------------------------------------------------ RECORDFILE FROM SERIALIZATION %s", *ptr); - recordfile = *ptr; - default: - break; - } - - token++; - ptr++; - + while (ptr != NULL && token < 6) { + switch (token) { + case 0: + DEBUG("------------------------------------------------------------------------------------------ HISTORYSTATE FROM SERIALIZATION %s", *ptr); + history_state = get_history_state_from_id (*ptr); + break; + case 1: + DEBUG("------------------------------------------------------------------------------------------ PEERNUMBER FROM SERIALIZATION %s", *ptr); + peer_number = *ptr; + break; + case 2: + DEBUG("------------------------------------------------------------------------------------------ PEERNAME FROM SERIALIZATION %s", *ptr); + peer_name = *ptr; + break; + case 3: + DEBUG("------------------------------------------------------------------------------------------ TIMESTOP FROM SERIALIZATION %s", *ptr); + time_stop = *ptr; + break; + case 4: + DEBUG("------------------------------------------------------------------------------------------ ACCOUNTID FROM SERIALIZATION %s", *ptr); + accountID = *ptr; + break; + case 5: + DEBUG("------------------------------------------------------------------------------------------ RECORDFILE FROM SERIALIZATION %s", *ptr); + recordfile = *ptr; + default: + break; } + token++; + ptr++; + } if (g_strcasecmp (peer_name, "empty") == 0) diff --git a/sflphone-client-gnome/src/callable_obj.h b/sflphone-client-gnome/src/callable_obj.h index db98a982769ba32bdbed752554abc9e709ca908b..7184eaf03d74e355a90114304dc01afea9f528b8 100644 --- a/sflphone-client-gnome/src/callable_obj.h +++ b/sflphone-client-gnome/src/callable_obj.h @@ -171,7 +171,7 @@ void create_new_call (callable_type_t, call_state_t, gchar*, gchar*, gchar*, gch void create_new_call_from_details (const gchar *, GHashTable *, callable_obj_t **); -void create_history_entry_from_serialized_form (gchar *, gchar *, callable_obj_t **); +void create_history_entry_from_serialized_form (gchar *, gchar **, callable_obj_t **); void call_add_error (callable_obj_t * call, gpointer dialog); diff --git a/sflphone-client-gnome/src/conference_obj.c b/sflphone-client-gnome/src/conference_obj.c index cf5255fdb56f4f41fd477c23234572dd6231acb2..663f971579d0879d25a1e23cb90e32332c9025ad 100644 --- a/sflphone-client-gnome/src/conference_obj.c +++ b/sflphone-client-gnome/src/conference_obj.c @@ -116,6 +116,7 @@ void create_new_conference_from_details (const gchar *conf_id, GHashTable *detai *conf = new_conf; } + void free_conference_obj_t (conference_obj_t *c) { g_free (c->_confID); @@ -231,3 +232,83 @@ gchar *serialize_history_conference_entry(conference_obj_t *entry) return result; } + +void create_conference_history_entry_from_serialized(gchar *timestamp, gchar **ptr, conference_obj_t **conf) +{ + gchar *conference_id = ""; + history_state_t history_state = MISSED; + gint token = 0; + conference_state_t state = CONFERENCE_STATE_ACTIVE_ATACHED; + gchar *participant = ""; + gchar *name = ""; + gchar *time_stop = ""; + gchar *accountID = ""; + gchar *recordfile = ""; + const gchar *confID = "conf_1234"; + + // create a new empty conference + create_new_conference(state, confID, conf); + + while(ptr != NULL && token < 6) { + switch(token) { + case 0: + history_state = MISSED; + break; + case 1: + participant = *ptr; + break; + case 2: + name = *ptr; + break; + case 3: + time_stop = *ptr; + break; + case 4: + accountID = *ptr; + break; + case 5: + recordfile = *ptr; + break; + default: + break; + } + + token++; + ptr++; + } +} + +void process_conference_participant_from_serialized(gchar *participant, conference_obj_t *conf) +{ + gchar **ptr = NULL; + gchar **numberptr = NULL; + gchar *delim = ";"; + gchar *delimnumber = ","; + gchar *numberaccount; + guint token = 0; + + ptr = g_strsplit(participant, delim, 0); + while(ptr != NULL) { + token = 0; + numberaccount = *ptr; + numberptr = g_strsplit(numberaccount, delimnumber, 2); + while(numberptr != NULL) { + gchar *phone_number = NULL; + gchar *account = NULL; + switch(token) { + case 0: + phone_number = *numberptr; + break; + case 1: + account = *numberptr; + break; + default: + break; + } + token++; + numberptr++; + + // we should create call here and add it to the conference to be inserted in history + } + } +} diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index b2f3da14aedcb714f42b1428ce18bc523f070c02..b986824ad387bccb0b616f8374caf3ff1586c1f2 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1316,29 +1316,17 @@ void ManagerImpl::createConfFromParticipantList(const std::vector< std::string > Conference *conf = new Conference(); - // std::vector< std::string >::iterator iter; - - // iter = participantList.begin(); - - /* - while(iter != participantList.end()) { - std::string participant = *iter; - _debug("PARTICIPANT LIST %s", participant.c_str()); - iter++; - } - */ - for(unsigned int i = 0; i < participantList.size(); i++) { std::string numberaccount = participantList[i]; - _debug("********************************************************************* PARTICIPANT %s", numberaccount.c_str()); std::string tostr = numberaccount.substr(0, numberaccount.find(",")); - _debug("********************************************************************* NUMBER %s", tostr.c_str()); std::string account = numberaccount.substr(numberaccount.find(",")+1, numberaccount.size()); - _debug("********************************************************************* NUMBER %s", account.c_str()); std::string generatedCallID = getNewCallID(); + conf->add(generatedCallID); + outgoingCall(account, generatedCallID, tostr, conf->getConfID()); + if(_dbus) { _dbus->getCallManager()->newCallCreated(account, generatedCallID, tostr); }