aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.h')
-rw-r--r--src/conversation/gnunet-conversation-gtk.h538
1 files changed, 8 insertions, 530 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h
index be6b0e9e..b4f1f203 100644
--- a/src/conversation/gnunet-conversation-gtk.h
+++ b/src/conversation/gnunet-conversation-gtk.h
@@ -22,9 +22,6 @@
22 * @file src/identity/gnunet-identity-gtk.h 22 * @file src/identity/gnunet-identity-gtk.h
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 */ 24 */
25#include <gnunet/gnunet_util_lib.h>
26#include <stdbool.h>
27
28#ifndef GNUNET_CONVERSATION_GTK_H 25#ifndef GNUNET_CONVERSATION_GTK_H
29#define GNUNET_CONVERSATION_GTK_H 26#define GNUNET_CONVERSATION_GTK_H
30 27
@@ -32,538 +29,19 @@
32 * macro's 29 * macro's
33 */ 30 */
34 31
35#define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ## __VA_ARGS__)) 32extern GObject *
36 33GNUNET_CONVERSATION_GTK_get_main_window_object (const char *);
37#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format, ## __VA_ARGS__))
38
39#define LOG(format, ...) log_message(g_strdup_printf (format, ## __VA_ARGS__))
40
41
42
43/**
44 * List of active calls
45 */
46 static GtkListStore *active_liststore;
47
48 /**
49 * List of active calls
50 */
51 static GtkTreeView *active_treeview;
52
53
54/*
55 * active calls treevieuw columns
56 */
57
58enum {
59 AL_caller_id, //*gchar
60 AL_caller, //*
61 AL_caller_num, //gint
62 AL_caller_type, //gint
63 AL_caller_state //gint
64};
65/**
66 * callerstate (state of incoming call)
67 */
68
69enum {
70 CT_active,
71 CT_suspended,
72 CT_ringing,
73 CT_dead,
74 CT_hangup,
75 CT_rejected
76};
77
78/**
79 * type of call
80 */
81enum {
82 CALL_IN,
83 CALL_OUT
84};
85
86
87/**
88 * Get our configuration.
89 *
90 * @return configuration handle
91 */
92const struct GNUNET_CONFIGURATION_Handle *
93GIG_get_configuration ();
94
95
96/**
97 * Handle to our main loop.
98 */
99static struct GNUNET_GTK_MainLoop *ml;
100
101/**
102 * Should gnunet-identity-gtk start in tray mode?
103 */
104static int tray_only;
105
106/**
107 * Head of operations.
108 */
109//static struct OperationContext *oc_head;
110
111/**
112 * Tail of operations.
113 */
114//static struct OperationContext *oc_tail;
115
116/**
117 * Possible states of the phone.
118 */
119enum PhoneState
120{
121 /**
122 * We're waiting for our own idenitty.
123 */
124 PS_LOOKUP_EGO,
125
126 /**
127 * We're listening for calls
128 */
129 PS_LISTEN,
130
131 /**
132 * We accepted an incoming phone call.
133 */
134 PS_ACCEPTED,
135
136 /**
137 * Internal error
138 */
139 PS_ERROR
140};
141
142/**
143 * States for current outgoing call.
144 */
145enum CallState
146{
147 /**
148 * We are looking up some other participant.
149 */
150 CS_RESOLVING,
151
152 /**
153 * We are now ringing the other participant.
154 */
155 CS_RINGING,
156
157 /**
158 * The other party accepted our call and we are now connected.
159 */
160 CS_CONNECTED,
161
162 /**
163 * The call is currently suspended (by us).
164 */
165 CS_SUSPENDED
166};
167
168enum CallHistoryType
169{
170 CH_ACCEPTED,
171 CH_REJECTED,
172 CH_OUTGOING,
173 CH_HANGUP,
174 CH_MISSED
175};
176
177
178
179/**
180 * List of incoming calls
181 */
182struct CallList
183{
184
185 /**
186 * A DLL.
187 */
188 struct CallList *prev;
189
190 /**
191 * A DLL.
192 */
193 struct CallList *next;
194
195 /**
196 * Handle to hang up or activate.
197 */
198 struct GNUNET_CONVERSATION_Caller *caller;
199
200 /**
201 * Handle to call currently selected in list
202 */
203 struct GNUNET_CONVERSATION_Caller *caller_selected;
204
205 /**
206 * String identifying the caller.
207 */
208 char *caller_id;
209
210 /**
211 * Unique number of the call.
212 */
213 unsigned int caller_num;
214
215};
216
217
218
219/**
220 * Phone handle
221 */
222static struct GNUNET_CONVERSATION_Phone *phone;
223
224/**
225 * Call handle (for active outgoing call).
226 */
227static struct GNUNET_CONVERSATION_Call *call;
228//static struct GtkTreeIter gcall;
229
230/**
231 * Caller handle (for active incoming call).
232 */
233static struct CallList *cl_active;
234//static GtkTreeIter gcl_active;
235
236/**
237 * Head of calls waiting to be accepted.
238 */
239static struct CallList *cl_head;
240//gtk
241//static GtkTreeIter gcl_head;
242
243/**
244 * currently selected call
245 */
246//static GtkTreeIter gcl_selected;
247
248/**
249 * Tail of calls waiting to be accepted.
250 */
251static struct CallList *cl_tail;
252//static GtkTreeIter gcl_tail;
253
254/**
255 * Desired phone line.
256 */
257static unsigned int line;
258
259//static unsigned int line1;
260/**
261 * debug box enabled
262 */
263
264static unsigned int debug_box_enabled;
265
266
267
268/**
269 * Our speaker.
270 */
271static struct GNUNET_SPEAKER_Handle *speaker;
272
273/**
274 * Our microphone.
275 */
276static struct GNUNET_MICROPHONE_Handle *mic;
277
278/**
279 * Our configurations.
280 */
281static struct GNUNET_CONFIGURATION_Handle *cfg;
282 34
283//static struct GNUNET_CONFIGURATION_Handle *cfg1;
284//static struct GNUNET_CONFIGURATION_Handle *cfg2;
285
286
287/**
288 * Our ego.
289 */
290static struct GNUNET_IDENTITY_Ego *caller_id;
291
292/**
293 * Handle to identity service.
294 */
295static struct GNUNET_IDENTITY_Handle *id;
296 35
297/** 36/**
298 * Name of our ego. 37 * log a message to gtk log textbuffer
38 * @param Message to be logged
299 */ 39 */
300static char *ego_name;
301
302/**
303 * Name of conversation partner (if any).
304 */
305static char *peer_name;
306
307/**
308 * Our phone's current state.
309 */
310static enum PhoneState phone_state;
311
312/**
313 * Our call's current state.
314 */
315static enum CallState call_state;
316
317/**
318 * Counts the number of incoming calls we have had so far.
319 */
320static unsigned int caller_num_gen;
321
322/**
323 * GNS address for this phone.
324 */
325static char *address;
326
327/**
328 * Be verbose.
329 */
330static int verbose = 1;
331
332/**
333 * Handle to the namestore.
334 */
335static struct GNUNET_NAMESTORE_Handle *ns;
336
337/**
338 * Private key for the our zone.
339 */
340struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey;
341
342/**
343 * Public key of the zone we are currently editing.
344 */
345struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
346
347
348
349/*
350 * List iterator for the 'list' operation.
351 */
352static struct GNUNET_NAMESTORE_ZoneIterator *list_it;
353
354
355/**
356 * Name of the records to add/list/remove.
357 */
358static char *name;
359
360static void
361identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
362 const char *name);
363
364
365/**
366 * List of contacts (records).
367 */
368static GtkListStore *contacts_liststore;
369
370
371/**
372 * List of contacts.
373 */
374static GtkTreeStore *contacts_treestore;
375
376/**
377 * The main tree view for 'gns' that shows the records.
378 */
379static GtkTreeView *contacts_treeview;
380
381/**
382 * Tree model (same object as 'contacts_treestore', just different type).
383 */
384static GtkTreeModel *contacts_treemodel;
385
386
387/**
388 * call history liststore
389 */
390static GtkListStore *history_liststore;
391
392/**
393 * call history treestore
394 */
395static GtkTreeStore *history_treestore;
396
397/**
398 * call histore treeview
399 */
400static GtkTreeView *history_treeview;
401
402/**
403 * call history tree model
404 */
405static GtkTreeModel *history_treemodel;
406
407
408/**
409 * list of zones
410 */
411static GtkListStore *zone_liststore;
412
413/**
414 * zone treestore
415 */
416static GtkTreeStore *zone_treestore;
417
418/**
419 * zone treeview
420 */
421static GtkTreeView *zone_treeview;
422
423/**
424 * zone tree model
425 */
426static GtkTreeModel *zone_treemodel;
427
428/**
429 * Current state of iterating elements for the client.
430 * NULL if we are not currently iterating.
431 */
432struct GNUNET_CONTAINER_MultiHashMapIterator *iter;
433
434/**
435 *name of the incomming caller pkey or record name if known
436*/
437char *callerName;
438
439/**
440* peer id of a contact
441*/
442char *peer_id;
443
444/**
445 * Queue entry for the 'add' operation.
446 */
447static struct GNUNET_NAMESTORE_QueueEntry *add_qe;
448
449/**
450 * Queue entry for the 'del' operation.
451 */
452static struct GNUNET_NAMESTORE_QueueEntry *del_qe;
453
454/**
455 * Global return value
456 */
457static int ret;
458
459/**
460* incoming call popup window, global because must be destroyed when other end hangs up
461*/
462GtkDialog *dialog;
463
464/**
465 * Context for edit operations and environment for plugins.
466 * Typical plugins will only use the @e check_validity callback.
467 */
468struct GNUNET_GTK_NAMESTORE_PluginEnvironment
469{
470
471 /**
472 * Function that should be called by the plugin whenever values in
473 * the dialog were edited. It will check the validity of the dialog
474 * and update the "save" button accordingly.
475 */
476 void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
477
478 /**
479 * Builder for the dialog.
480 */
481 GtkBuilder *builder;
482
483 /**
484 * Main dialog window.
485 */
486 GtkDialog *dialog;
487
488 /**
489 * Where in the tree view are we editing?
490 */
491 struct RecordInfo *ri;
492
493 /**
494 * Name of the record.
495 */
496 gchar *name;
497
498 /**
499 * Value of the record in string format.
500 */
501 gchar *n_value;
502
503 /**
504 * Name of the zone into which the record should be placed.
505 */
506 gchar *new_zone_option;
507
508 /**
509 * Ego of the zone into which the record should be placed.
510 */
511 struct GNUNET_IDENTITY_Ego *ego;
512
513 /**
514 * List of all zones.
515 */
516 GtkListStore *zone_liststore;
517
518 /**
519 * The plugin we used to edit the value.
520 */
521 struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
522
523 /**
524 * Name of the plugin library.
525 */
526 char *liblow;
527
528 /**
529 * Expiration time value (absolute or relative).
530 */
531 guint64 n_exp_time;
532
533 /**
534 * Offset of the record we are editing in the 'rd' list of 'ri'.
535 */
536 unsigned int off;
537
538 /**
539 * Flag indicating if the old record was in the namestore.
540 */
541 int old_record_in_namestore;
542
543 /**
544 * Type of the record.
545 */
546 uint32_t record_type;
547
548 /**
549 * Is this record 'public'?
550 */
551 gboolean n_public;
552
553 /**
554 * Is the expiration time relative?
555 */
556 gboolean n_is_relative;
557
558 /**
559 * Is this record a shadow record?
560 */
561 gboolean n_is_shadow;
562
563};
564 40
565static struct GNUNET_IDENTITY_Ego *currentAddressBookEgo; 41extern void
42GNUNET_CONVERSATION_GTK_log_message (const char *);
566 43
567char *currentlySelectedCallAddress; 44extern void
45do_call(const char*);
568 46
569#endif 47#endif