gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6385 - GNUnet/src/applications/chat


From: gnunet
Subject: [GNUnet-SVN] r6385 - GNUnet/src/applications/chat
Date: Tue, 19 Feb 2008 17:02:07 -0700 (MST)

Author: nevans
Date: 2008-02-19 17:02:07 -0700 (Tue, 19 Feb 2008)
New Revision: 6385

Modified:
   GNUnet/src/applications/chat/chat.c
Log:


Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2008-02-20 00:00:44 UTC (rev 6384)
+++ GNUnet/src/applications/chat/chat.c 2008-02-20 00:02:07 UTC (rev 6385)
@@ -63,7 +63,7 @@
        struct GNUNET_ClientHandle *client;
        struct GNUNET_CS_chat_client *next;
        struct GNUNET_CS_chat_client *prev;
-       GNUNET_HashCode *room_name_hash;
+       GNUNET_HashCode room_name_hash;
 
 };
 
@@ -111,6 +111,7 @@
   struct GNUNET_CS_chat_client *tempClient;
   
   GNUNET_HashCode hc;
+  GNUNET_HashCode room_name_hash;
 
   char *nick;
   char *message_content;
@@ -149,6 +150,8 @@
   nick[nick_len] = '\0';
   message_content[msg_len] = '\0';
   room_name[room_name_len] = '\0';
+  
+  GNUNET_hash(room_name,strlen(room_name),&room_name_hash);
 
   GNUNET_GE_LOG (ectx,
                  GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
@@ -166,11 +169,10 @@
        tempClient = &client_list;
   while((tempClient->next != NULL)&&(tempClient->client != NULL))
   {
-       if(memcmp(&hc,tempClient->room_name_hash,sizeof(hc)))
+       
if(memcmp(&room_name_hash,&tempClient->room_name_hash,sizeof(GNUNET_HashCode))==0)
        {
                fprintf(stderr,"room names match, must send message to 
others!!\n");
                coreAPI->cs_send_to_client (tempClient->client, message, 
GNUNET_YES);
-               fprintf(stderr,"message sent?\n");
        }
        
        tempClient = tempClient->next;  
@@ -197,6 +199,7 @@
   const CS_chat_JOIN_MESSAGE *cmsg;
   P2P_chat_MESSAGE *pmsg;
   GNUNET_HashCode hc;
+  GNUNET_HashCode room_name_hash;
 
   char *nick;
   GNUNET_RSA_PublicKey *client_key;
@@ -245,6 +248,7 @@
   nick[nick_len] = '\0';
   room_name[room_name_len] = '\0';
   GNUNET_hash (cmsg, header_size, &hc);
+  GNUNET_hash(room_name,strlen(room_name),&room_name_hash);
   GNUNET_mutex_lock (chatMutex);
   markSeen (&hc);
   
@@ -256,7 +260,7 @@
        tempClient->client = client;
        tempClient->next = GNUNET_malloc(sizeof(struct GNUNET_CS_chat_client));
        tempClient->next->prev = tempClient;
-       tempClient->room_name_hash = &hc;
+       
memcpy(&tempClient->room_name_hash,&room_name_hash,sizeof(GNUNET_HashCode));
        tempClient = &client_list;
        
        tempCount = 0;
@@ -444,4 +448,5 @@
   coreAPI = NULL;
 }
 
+
 /* end of chat.c */





reply via email to

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