gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6944 - in GNUnet/src/applications/chat: . lib module tools


From: gnunet
Subject: [GNUnet-SVN] r6944 - in GNUnet/src/applications/chat: . lib module tools
Date: Sat, 31 May 2008 13:24:21 -0600 (MDT)

Author: grothoff
Date: 2008-05-31 13:24:20 -0600 (Sat, 31 May 2008)
New Revision: 6944

Added:
   GNUnet/src/applications/chat/lib/
   GNUnet/src/applications/chat/lib/Makefile.am
   GNUnet/src/applications/chat/module/
   GNUnet/src/applications/chat/module/Makefile.am
   GNUnet/src/applications/chat/tools/
   GNUnet/src/applications/chat/tools/Makefile.am
Modified:
   GNUnet/src/applications/chat/Makefile.am
   GNUnet/src/applications/chat/chat.c
   GNUnet/src/applications/chat/chat.h
   GNUnet/src/applications/chat/clientapi.c
Log:
chat reorg step 1

Modified: GNUnet/src/applications/chat/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/Makefile.am    2008-05-31 06:16:00 UTC (rev 
6943)
+++ GNUnet/src/applications/chat/Makefile.am    2008-05-31 19:24:20 UTC (rev 
6944)
@@ -26,8 +26,7 @@
   $(top_builddir)/src/util/libgnunetutil.la 
 
 libgnunetmodule_chat_la_SOURCES = \
-  chat.c chat.h \
-  chat_p2p.c chat_p2p.h
+  chat.c chat.h
 libgnunetmodule_chat_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la
 libgnunetmodule_chat_la_LDFLAGS = \

Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2008-05-31 06:16:00 UTC (rev 6943)
+++ GNUnet/src/applications/chat/chat.c 2008-05-31 19:24:20 UTC (rev 6944)
@@ -65,11 +65,14 @@
 csHandleTransmitRequest (struct GNUNET_ClientHandle *client,
                          const GNUNET_MessageHeader * message)
 {
+  static GNUNET_HashCode all_zeros;
   const CS_chat_MESSAGE_TransmitRequest *cmsg;
   CS_chat_MESSAGE_ReceiveNotification *rmsg;
+  CS_chat_MESSAGE_ConfirmationReceipt receipt;
   struct GNUNET_CS_chat_client *pos;
   const char *room;
   unsigned int msg_len;
+  int priv_msg;
 
   if (ntohs (message->size) < sizeof (CS_chat_MESSAGE_TransmitRequest))
     {
@@ -101,14 +104,44 @@
     rmsg->sender = pos->id;
   else
     memset (&rmsg->sender, 0, sizeof (GNUNET_HashCode));
+  priv_msg = (0 == memcmp(&all_zeros,
+                         &cmsg->target,
+                         sizeof(GNUNET_HashCode)));
+  memcpy(&rmsg[1],
+        &cmsg[1],
+        msg_len);
   pos = client_list_head;
   while (pos != NULL)
     {
       if (0 == strcmp (room, pos->room))
         {
-          /* FIXME: private msg delivery, blocking options,
-             confirmation */
-          coreAPI->cs_send_message (pos->client, &rmsg->header, GNUNET_YES);
+         if ( ( (!priv_msg) ||
+                (0 == memcmp(&cmsg->target,
+                             &pos->id,
+                             sizeof(GNUNET_HashCode))) ) &&
+              ( (0 == ntohl(cmsg->msg_options)) & (~pos->msg_options) ) )
+           {
+             coreAPI->cs_send_message (pos->client, &rmsg->header, GNUNET_YES);
+             if (0 != (ntohl(cmsg->msg_options)&GNUNET_CHAT_MSG_ACKNOWLEDGED))
+               {
+                 receipt.header.size = 
htons(sizeof(CS_chat_MESSAGE_ConfirmationReceipt));
+                 receipt.header.type = 
htons(GNUNET_CS_PROTO_CHAT_CONFIRMATION_RECEIPT);
+                 receipt.sequence_number = cmsg->sequence_number;
+                 receipt.timestamp = GNUNET_htonll(GNUNET_get_time());
+                 receipt.target = pos->id;
+                 /* FIXME: this will currently *always* be the plaintext 
message;
+                    once we have P2P, we want to sign the encrypted message
+                    (which we currently do not even generate!) */
+                 GNUNET_hash(&cmsg[1],
+                             msg_len,
+                             &receipt.content);
+                 GNUNET_RSA_sign(pos->private_key,
+                                 sizeof(CS_chat_MESSAGE_ConfirmationReceipt) - 
sizeof(GNUNET_RSA_Signature),
+                                 &receipt,
+                                 &receipt.signature);            
+                 coreAPI->cs_send_message (client, &receipt.header, 
GNUNET_YES);
+               }
+           }
         }
       pos = pos->next;
     }

Modified: GNUnet/src/applications/chat/chat.h
===================================================================
--- GNUnet/src/applications/chat/chat.h 2008-05-31 06:16:00 UTC (rev 6943)
+++ GNUnet/src/applications/chat/chat.h 2008-05-31 19:24:20 UTC (rev 6944)
@@ -21,10 +21,10 @@
 /**
  * @author Christian Grothoff
  * @author Nathan Evans
- * @file applications/chat/chat.h
+ * @file chat.h
  **/
-#ifndef CHAT_CHAT_H
-#define CHAT_CHAT_H
+#ifndef CHAT_H
+#define CHAT_H
 
 #include "gnunet_core.h"
 #include "gnunet_chat_lib.h"

Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c    2008-05-31 06:16:00 UTC (rev 
6943)
+++ GNUnet/src/applications/chat/clientapi.c    2008-05-31 19:24:20 UTC (rev 
6944)
@@ -49,8 +49,6 @@
 
   struct GNUNET_ECRS_MetaData *member_info;
 
-  char *nickname;               /* not really required */
-
   char *room_name;
 
   GNUNET_RSA_PrivateKeyEncoded *my_private_key;
@@ -400,7 +398,6 @@
       return NULL;
     }
   chat_room = GNUNET_malloc (sizeof (struct GNUNET_CHAT_Room));
-  chat_room->nickname = GNUNET_strdup (nick_name);
   chat_room->room_name = GNUNET_strdup (room_name);
   chat_room->member_info = GNUNET_ECRS_meta_data_duplicate (member_info);
   chat_room->my_private_key = key;
@@ -417,7 +414,6 @@
     GNUNET_thread_create (&poll_thread, chat_room, 1024 * 2);
   if (chat_room->listen_thread == NULL)
     {
-      GNUNET_free (chat_room->nickname);
       GNUNET_free (chat_room->room_name);
       GNUNET_client_connection_destroy (chat_room->sock);
       GNUNET_ECRS_meta_data_destroy (chat_room->member_info);
@@ -446,7 +442,6 @@
   GNUNET_thread_stop_sleep (chat_room->listen_thread);
   GNUNET_thread_join (chat_room->listen_thread, &unused);
   GNUNET_free (chat_room->room_name);
-  GNUNET_free (chat_room->nickname);
   GNUNET_ECRS_meta_data_destroy (chat_room->member_info);
   GNUNET_client_connection_destroy (chat_room->sock);
   GNUNET_free (chat_room->my_private_key);

Added: GNUnet/src/applications/chat/lib/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/lib/Makefile.am                                
(rev 0)
+++ GNUnet/src/applications/chat/lib/Makefile.am        2008-05-31 19:24:20 UTC 
(rev 6944)
@@ -0,0 +1,48 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la 
+
+plugindir = $(libdir)/GNUnet
+
+plugin_LTLIBRARIES = \
+  libgnunetmodule_chat.la
+
+lib_LTLIBRARIES = \
+  libgnunetchat_api.la
+
+bin_PROGRAMS = \
+ gnunet-chat
+
+gnunet_chat_SOURCES = \
+ gnunet-chat.c         
+gnunet_chat_LDADD = \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la 
+
+libgnunetchat_api_la_SOURCES = \
+  clientapi.c 
+libgnunetchat_api_la_LIBADD = \
+  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+libgnunetmodule_chat_la_SOURCES = \
+  chat.c chat.h
+libgnunetmodule_chat_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la
+libgnunetmodule_chat_la_LDFLAGS = \
+  -export-dynamic -avoid-version -module
+
+
+
+check_PROGRAMS = \
+  chattest
+
+TESTS = $(check_PROGRAMS)
+
+chattest_SOURCES = \
+  chattest.c 
+chattest_LDADD = \
+  $(top_builddir)/src/applications/testing/libgnunettesting_api.la \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la \
+  $(top_builddir)/src/util/libgnunetutil.la 

Added: GNUnet/src/applications/chat/module/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/module/Makefile.am                             
(rev 0)
+++ GNUnet/src/applications/chat/module/Makefile.am     2008-05-31 19:24:20 UTC 
(rev 6944)
@@ -0,0 +1,48 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la 
+
+plugindir = $(libdir)/GNUnet
+
+plugin_LTLIBRARIES = \
+  libgnunetmodule_chat.la
+
+lib_LTLIBRARIES = \
+  libgnunetchat_api.la
+
+bin_PROGRAMS = \
+ gnunet-chat
+
+gnunet_chat_SOURCES = \
+ gnunet-chat.c         
+gnunet_chat_LDADD = \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la 
+
+libgnunetchat_api_la_SOURCES = \
+  clientapi.c 
+libgnunetchat_api_la_LIBADD = \
+  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+libgnunetmodule_chat_la_SOURCES = \
+  chat.c chat.h
+libgnunetmodule_chat_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la
+libgnunetmodule_chat_la_LDFLAGS = \
+  -export-dynamic -avoid-version -module
+
+
+
+check_PROGRAMS = \
+  chattest
+
+TESTS = $(check_PROGRAMS)
+
+chattest_SOURCES = \
+  chattest.c 
+chattest_LDADD = \
+  $(top_builddir)/src/applications/testing/libgnunettesting_api.la \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la \
+  $(top_builddir)/src/util/libgnunetutil.la 

Added: GNUnet/src/applications/chat/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/tools/Makefile.am                              
(rev 0)
+++ GNUnet/src/applications/chat/tools/Makefile.am      2008-05-31 19:24:20 UTC 
(rev 6944)
@@ -0,0 +1,48 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la 
+
+plugindir = $(libdir)/GNUnet
+
+plugin_LTLIBRARIES = \
+  libgnunetmodule_chat.la
+
+lib_LTLIBRARIES = \
+  libgnunetchat_api.la
+
+bin_PROGRAMS = \
+ gnunet-chat
+
+gnunet_chat_SOURCES = \
+ gnunet-chat.c         
+gnunet_chat_LDADD = \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la 
+
+libgnunetchat_api_la_SOURCES = \
+  clientapi.c 
+libgnunetchat_api_la_LIBADD = \
+  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+libgnunetmodule_chat_la_SOURCES = \
+  chat.c chat.h
+libgnunetmodule_chat_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la
+libgnunetmodule_chat_la_LDFLAGS = \
+  -export-dynamic -avoid-version -module
+
+
+
+check_PROGRAMS = \
+  chattest
+
+TESTS = $(check_PROGRAMS)
+
+chattest_SOURCES = \
+  chattest.c 
+chattest_LDADD = \
+  $(top_builddir)/src/applications/testing/libgnunettesting_api.la \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/applications/chat/libgnunetchat_api.la \
+  $(top_builddir)/src/util/libgnunetutil.la 





reply via email to

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