aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 5ac39aea..d8c38a40 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -133,7 +133,7 @@ update_status (const gchar * message)
133/* 133/*
134 * adds a item to the call history 134 * adds a item to the call history
135 * 135 *
136 * @param type type of call: 1: accepted 2: rejected 136 * @param type type of call: 0: accepted 1: rejected 2: outgoing call
137 * @return void 137 * @return void
138 */ 138 */
139 139
@@ -142,10 +142,28 @@ history_add (int type, char *contactName)
142{ 142{
143 GtkTreeIter iter; 143 GtkTreeIter iter;
144 time_t t; 144 time_t t;
145 145 char *event;
146 switch (type)
147 {
148 case 0:
149 event = "Accepted";
150 break;
151 case 1:
152 event = "Rejected";
153 break;
154 case 2:
155 event = "Outgoing";
156 break;
157 case 3:
158 event = "Hangup";
159 break;
160 case 4:
161 event = "Missed";
162 break;
163 }
146 time (&t); 164 time (&t);
147 gtk_list_store_append (history_liststore, &iter); 165 gtk_list_store_append (history_liststore, &iter);
148 gtk_list_store_set (history_liststore, &iter, 1, type, 0, ctime (&t), 2, 166 gtk_list_store_set (history_liststore, &iter, 1, event, 0, ctime (&t), 2,
149 contactName, -1); 167 contactName, -1);
150} 168}
151 169
@@ -275,8 +293,8 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code,
275 cl->caller_id = GNUNET_strdup (caller_id); 293 cl->caller_id = GNUNET_strdup (caller_id);
276 cl->caller_num = caller_num_gen++; 294 cl->caller_num = caller_num_gen++;
277 GNUNET_CONTAINER_DLL_insert (cl_head, cl_tail, cl); 295 GNUNET_CONTAINER_DLL_insert (cl_head, cl_tail, cl);
278 strncpy (&callerName, &caller_id, 50); 296 //strncpy (&callerName, &caller_id, 50);
279 callerName[52] = '\0'; 297 //callerName[52] = '\0';
280 quick_message ("der is een beller", caller_id); 298 quick_message ("der is een beller", caller_id);
281 299
282 break; 300 break;
@@ -465,6 +483,7 @@ do_call (const char *arg)
465 &call_event_handler, NULL); 483 &call_event_handler, NULL);
466 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing.\n"), 484 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing.\n"),
467 peer_name); 485 peer_name);
486 history_add(2,peer_name);
468} 487}
469 488
470 489
@@ -493,7 +512,7 @@ do_accept (const char *args)
493 break; 512 break;
494 case PS_LISTEN: 513 case PS_LISTEN:
495 /* this is the expected state */ 514 /* this is the expected state */
496 break; 515 break;
497 case PS_ACCEPTED: 516 case PS_ACCEPTED:
498 LOG (_ 517 LOG (_
499 ("You are answering call from `%s', hang up or suspend that call first!\n"), 518 ("You are answering call from `%s', hang up or suspend that call first!\n"),
@@ -523,13 +542,14 @@ do_accept (const char *args)
523 LOG (_("There is no incoming call `%s' to accept right now!\n"), args); 542 LOG (_("There is no incoming call `%s' to accept right now!\n"), args);
524 return; 543 return;
525 } 544 }
526 cl_active = cl; 545 cl_active = cl;
527 GNUNET_free_non_null (peer_name); 546 GNUNET_free_non_null (peer_name);
528 peer_name = GNUNET_strdup (cl->caller_id); 547 peer_name = GNUNET_strdup (cl->caller_id);
529 phone_state = PS_ACCEPTED; 548 phone_state = PS_ACCEPTED;
530 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl, 549 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl,
531 speaker, mic); 550 speaker, mic);
532 history_add ("1", peer_name); 551
552 history_add (0, peer_name);
533 553
534} 554}
535 555
@@ -775,7 +795,7 @@ do_reject (const char *args)
775 break; 795 break;
776 } 796 }
777 //FPRINTF(stderr,"blaalalal %s",peer_name); 797 //FPRINTF(stderr,"blaalalal %s",peer_name);
778 history_add ("2", peer_name); 798 history_add (1, peer_name);
779 799
780} 800}
781 801
@@ -1158,9 +1178,9 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1158 { 1178 {
1159 ego_name = "phone-ego"; 1179 ego_name = "phone-ego";
1160 LOG ("%s", _("No ego given, using default \"phone-ego\" \n")); 1180 LOG ("%s", _("No ego given, using default \"phone-ego\" \n"));
1161 return; 1181 //return;
1162 } 1182 }
1163 1183 FPRINTF(stderr, "ego: %s \n", ego_name);
1164 1184
1165 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); 1185 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
1166 1186
@@ -1252,7 +1272,7 @@ quick_message (gchar * message, const char *caller_id)
1252 do_accept("0"); 1272 do_accept("0");
1253 break; 1273 break;
1254 case GTK_RESPONSE_REJECT : 1274 case GTK_RESPONSE_REJECT :
1255 do_reject(NULL); 1275 do_reject("0");
1256 do_status(""); 1276 do_status("");
1257 gtk_widget_destroy(GTK_WIDGET(dialog)); 1277 gtk_widget_destroy(GTK_WIDGET(dialog));
1258 break; 1278 break;
@@ -1299,8 +1319,9 @@ GNUNET_CONVERSATION_GTK_on_hangup_clicked ()
1299 1319
1300 1320
1301 //FPRINTF (stderr, "hangup clicked \n"); 1321 //FPRINTF (stderr, "hangup clicked \n");
1302 do_reject (""); 1322 do_reject (NULL);
1303 do_status (""); 1323 do_status ("");
1324 history_add(3,peer_name);
1304} 1325}
1305 1326
1306/** 1327/**
@@ -1602,4 +1623,11 @@ GNUNET_CONVERSATION_GTK_row_activated ()
1602} 1623}
1603 1624
1604/* end of gnunet-conversation-gtk.c */ 1625/* end of gnunet-conversation-gtk.c */
1605 1626void GNUNET_contact_test()
1627{
1628 history_add(0,"test");
1629 history_add(1,"test");
1630 history_add(2,"test");
1631 history_add(3,"test");
1632 history_add(4,"test");
1633}