Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
a68876fa
Commit
a68876fa
authored
Mar 05, 2009
by
Emmanuel Milou
Browse files
factorize call creation
parent
cd313efa
Changes
6
Hide whitespace changes
Inline
Side-by-side
sflphone-gtk/src/calllist.c
View file @
a68876fa
...
...
@@ -218,3 +218,23 @@ call_get_selected (calltab_t* tab)
{
return
tab
->
selectedCall
;
}
void
create_new_call
(
gchar
*
to
,
gchar
*
from
,
call_state_t
state
,
gchar
*
accountID
,
call_t
**
new_call
)
{
gchar
*
call_id
;
call_t
*
call
;
call
=
g_new0
(
call_t
,
1
);
call
->
to
=
g_strdup
(
to
);
call
->
from
=
g_strdup
(
from
);
call
->
state
=
state
;
call
->
accountID
=
g_strdup
(
accountID
);
call
->
_start
=
0
;
call
->
_stop
=
0
;
call_id
=
g_new0
(
gchar
,
30
);
g_sprintf
(
call_id
,
"%d"
,
rand
());
call
->
callID
=
g_strdup
(
call_id
);
*
new_call
=
call
;
}
sflphone-gtk/src/calllist.h
View file @
a68876fa
...
...
@@ -81,9 +81,9 @@ typedef enum
*/
typedef
enum
{
HOME
,
C
ELLPHONE
,
WORK
CONTACT_PHONE_
HOME
,
C
ONTACT_PHONE_BUSINESS
,
CONTACT_PHONE_MOBILE
}
contact_type_t
;
/** @struct call_t
...
...
@@ -106,8 +106,6 @@ typedef struct {
call_state_t
state
;
/** The history state if necessary */
history_state_t
history_state
;
/** The contact type if necessary */
contact_type_t
contact_type
;
time_t
_start
;
time_t
_stop
;
...
...
@@ -205,4 +203,5 @@ void call_list_clean_history();
*/
void
call_list_remove_from_history
(
call_t
*
c
);
void
create_new_call
(
gchar
*
to
,
gchar
*
from
,
call_state_t
state
,
gchar
*
accountID
,
call_t
**
new_call
);
#endif
sflphone-gtk/src/calltree.c
View file @
a68876fa
...
...
@@ -254,15 +254,13 @@ show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
{
Hit
*
entry
;
entry
=
i
->
data
;
if
(
i
->
data
)
if
(
entry
)
{
call_t
*
call
;
call
=
g_new0
(
call_t
,
1
);
call
->
from
=
g_strconcat
(
"
\"
"
,
entry
->
name
,
"
\"
<"
,
entry
->
phone
,
">"
,
NULL
);
call
->
from
=
g_strconcat
(
"
\"
"
,
entry
->
name
,
"
\"
<"
,
entry
->
phone
_business
,
">"
,
NULL
);
call
->
state
=
CALL_STATE_DIALING
;
//call->history_state = MISSED;
call
->
contact_type
=
HOME
;
call_list_add
(
contacts
,
call
);
update_call_tree_add
(
contacts
,
call
);
...
...
@@ -284,24 +282,25 @@ show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
static
void
call_mailbox
(
GtkWidget
*
widget
UNUSED
,
gpointer
data
UNUSED
)
{
account_t
*
current
=
account_list_get_current
();
if
(
current
==
NULL
)
// Should not happens
return
;
call_t
*
mailboxCall
=
g_new0
(
call_t
,
1
);
mailboxCall
->
state
=
CALL_STATE_DIALING
;
mailboxCall
->
to
=
g_strdup
(
g_hash_table_lookup
(
current
->
properties
,
ACCOUNT_MAILBOX
));
mailboxCall
->
from
=
g_markup_printf_escaped
(
_
(
"
\"
Voicemail
\"
<%s>"
),
mailboxCall
->
to
);
mailboxCall
->
callID
=
g_new0
(
gchar
,
30
);
g_sprintf
(
mailboxCall
->
callID
,
"%d"
,
rand
());
mailboxCall
->
accountID
=
g_strdup
(
current
->
accountID
);
mailboxCall
->
_start
=
0
;
mailboxCall
->
_stop
=
0
;
g_print
(
"TO : %s
\n
"
,
mailboxCall
->
to
);
call_list_add
(
current_calls
,
mailboxCall
);
update_call_tree_add
(
current_calls
,
mailboxCall
);
update_menus
();
sflphone_place_call
(
mailboxCall
);
switch_tab
(
current_calls
);
account_t
*
current
;
call_t
*
mailbox_call
;
gchar
*
to
,
*
from
,
*
account_id
;
current
=
account_list_get_current
();
if
(
current
==
NULL
)
// Should not happens
return
;
to
=
g_strdup
(
g_hash_table_lookup
(
current
->
properties
,
ACCOUNT_MAILBOX
));
from
=
g_markup_printf_escaped
(
_
(
"
\"
Voicemail
\"
<%s>"
),
to
);
account_id
=
g_strdup
(
current
->
accountID
);
create_new_call
(
to
,
from
,
CALL_STATE_DIALING
,
account_id
,
&
mailbox_call
);
g_print
(
"TO : %s
\n
"
,
mailbox_call
->
to
);
call_list_add
(
current_calls
,
mailbox_call
);
update_call_tree_add
(
current_calls
,
mailbox_call
);
update_menus
();
sflphone_place_call
(
mailbox_call
);
switch_tab
(
current_calls
);
}
...
...
@@ -930,21 +929,23 @@ update_call_tree_add (calltab_t* tab, call_t * c)
}
else
if
(
tab
==
contacts
)
{
switch
(
c
->
contact_type
)
/*
switch (c->contact_type)
{
case
HOME
:
case
CONTACT_PHONE_
HOME:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/face-monkey.svg", NULL);
break;
case
WORK
:
case
CONTACT_PHONE_BUSINESS
:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/face-monkey.svg", NULL);
break;
case
C
ELLPHON
E
:
case C
ONTACT_PHONE_MOBIL
E:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/contact_default.svg", NULL);
break;
default:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/contact_default.svg", NULL);
break;
}
}*/
pixbuf
=
gdk_pixbuf_new_from_file
(
ICONS_DIR
"/face-monkey.svg"
,
NULL
);
description
=
g_strconcat
(
description
,
NULL
);
}
...
...
sflphone-gtk/src/contactlist/eds.c
View file @
a68876fa
...
...
@@ -39,7 +39,7 @@ void
free_hit
(
Hit
*
h
)
{
g_free
(
h
->
name
);
g_free
(
h
->
phone
);
g_free
(
h
->
phone
_business
);
g_free
(
h
);
}
...
...
@@ -167,16 +167,16 @@ search_sync (const char *query,
contact
=
E_CONTACT
(
contacts
->
data
);
hit
=
g_new
(
Hit
,
1
);
hit
->
phone
=
g_strdup
((
char
*
)
e_contact_get_const
(
contact
,
E_CONTACT_PHONE_BUSINESS
));
if
(
!
hit
->
phone
)
hit
->
phone
_business
=
g_strdup
((
char
*
)
e_contact_get_const
(
contact
,
E_CONTACT_PHONE_BUSINESS
));
if
(
!
hit
->
phone
_business
)
{
// Temporary fix for empty phone numbers
sprintf
(
ext
,
"%d"
,
rand
()
%
100
+
100
);
hit
->
phone
=
g_strconcat
(
"rand"
,
ext
,
NULL
);
hit
->
phone
_business
=
g_strconcat
(
"rand"
,
ext
,
NULL
);
//hit->phone = "";
}
hit
->
name
=
g_strdup
((
char
*
)
e_contact_get_const
(
contact
,
E_CONTACT_NAME_OR_ORG
));
if
(
!
hit
->
name
)
hit
->
name
=
""
;
...
...
sflphone-gtk/src/contactlist/eds.h
View file @
a68876fa
...
...
@@ -34,10 +34,10 @@ G_BEGIN_DECLS
typedef
struct
_Hit
{
gchar
*
name
;
gchar
*
phone
;
gchar
*
phone
_business
;
}
Hit
;
void
free_hit
(
Hit
*
h
it
);
void
free_hit
(
Hit
*
h
);
void
init
(
void
);
...
...
sflphone-gtk/src/sflphone_const.h
View file @
a68876fa
...
...
@@ -94,4 +94,5 @@
/** Desktop notifications - Time before to close the notification*/
#define __TIMEOUT_TIME 18000 // 30 secondes
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment