gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33554 - gnunet-gtk/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r33554 - gnunet-gtk/src/conversation
Date: Fri, 6 Jun 2014 10:57:31 +0200

Author: grothoff
Date: 2014-06-06 10:57:31 +0200 (Fri, 06 Jun 2014)
New Revision: 33554

Modified:
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
Log:
adapt to latest API change: allow caller ID to differ from resolution zone

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-06-06 
08:57:09 UTC (rev 33553)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-06-06 
08:57:31 UTC (rev 33554)
@@ -207,6 +207,12 @@
   char *caller_id_str;
 
   /**
+   * Namestore handle for our reverse lookup (to convert
+   * @e caller_id into *nice* human-readable @e caller_id_str).
+   */
+  struct GNUNET_NAMESTORE_QueueEntry *qe;
+
+  /**
    * Location of this call in the list.
    */
   GtkTreeRowReference *rr;
@@ -423,6 +429,8 @@
     ic->caller = NULL;
   }
   GNUNET_free (ic->caller_id_str);
+  if (NULL != ic->qe)
+    GNUNET_NAMESTORE_cancel (ic->qe);
   if (NULL != ic->rr)
     gtk_tree_row_reference_free (ic->rr);
   GNUNET_free (ic);
@@ -852,6 +860,29 @@
 
 
 /**
+ * Process a record that was stored in the namestore.
+ *
+ * @param cls closure with the `struct IncomingCall *`
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array, 0 if label was deleted
+ * @param rd array of records with data to store
+ */
+static void
+handle_reverse_lookup_result (void *cls,
+                              const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+                              const char *label,
+                              unsigned int rd_count,
+                              const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct IncomingCall *ic = cls;
+
+  ic->qe = NULL;
+  // FIXME!
+}
+
+
+/**
  * Function called with an event emitted by a phone.
  *
  * @param cls closure
@@ -869,6 +900,7 @@
   gboolean valid;
   struct IncomingCall *ic;
   GtkTreePath *path;
+  struct GNUNET_IDENTITY_Ego *my_zone;
 
   switch (code)
   {
@@ -879,7 +911,13 @@
     ic->state = IN_STATE_RINGING;
     ic->caller_id = *caller_id;
     ic->caller_id_str = GNUNET_strdup (GNUNET_GNSRECORD_pkey_to_zkey 
(caller_id));
-    // FIXME: initiate reverse lookup!
+
+    my_zone = GCG_ZONES_get_selected_zone ();
+    ic->qe = GNUNET_NAMESTORE_zone_to_name (GCG_IMPORT_get_namestore (),
+                                            
GNUNET_IDENTITY_ego_get_private_key (my_zone),
+                                            &ic->caller_id,
+                                            &handle_reverse_lookup_result,
+                                            ic);
     ic->caller_num = caller_num_gen++;
     gtk_list_store_insert_with_values (active_liststore,
                                        &iter,
@@ -1525,13 +1563,15 @@
 
 {
   struct GNUNET_IDENTITY_Ego *caller_id;
+  struct GNUNET_IDENTITY_Ego *zone_id;
   GtkTreePath *path;
   GtkTreeIter iter;
   struct OutgoingCall *oc;
   const char *arg;
 
   arg = gtk_entry_get_text (address_entry);
-  caller_id = GCG_ZONES_get_selected_zone ();
+  caller_id = GCG_EGOS_get_selected_ego ();
+  zone_id = GCG_ZONES_get_selected_zone ();
   if ( (NULL == caller_id) ||
        (NULL != active_out) ||
        (NULL != active_in) )
@@ -1549,6 +1589,7 @@
   oc->call =
     GNUNET_CONVERSATION_call_start (GCG_get_configuration (),
                                     caller_id,
+                                    zone_id,
                                     arg,
                                     speaker, mic,
                                     &call_event_handler, oc);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]