aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2008-03-03 22:24:46 +0000
committerNathan S. Evans <evans@in.tum.de>2008-03-03 22:24:46 +0000
commit7f6742ab2c543b163f9de67baff44236d8bf66fe (patch)
treed43f0323724dd8afffe5f4d5712dfc9a13961f3f
parent8c9707e39a8c98505e0ac92f9eb579a20055d43b (diff)
downloadgnunet-gtk-7f6742ab2c543b163f9de67baff44236d8bf66fe.tar.gz
gnunet-gtk-7f6742ab2c543b163f9de67baff44236d8bf66fe.zip
-rw-r--r--src/plugins/chat/chat.c23
-rw-r--r--src/plugins/chat/chat.h63
2 files changed, 74 insertions, 12 deletions
diff --git a/src/plugins/chat/chat.c b/src/plugins/chat/chat.c
index bbf43035..6beab3fb 100644
--- a/src/plugins/chat/chat.c
+++ b/src/plugins/chat/chat.c
@@ -30,6 +30,8 @@
30 30
31const GNUNET_RSA_PublicKey pub_key; 31const GNUNET_RSA_PublicKey pub_key;
32const struct GNUNET_RSA_PrivateKey *priv_key; 32const struct GNUNET_RSA_PrivateKey *priv_key;
33struct GNUNET_GE_Context *ectx;
34struct GNUNET_GC_Configuration *cfg;
33 35
34/** 36/**
35 * A message was sent in the chat to us. 37 * A message was sent in the chat to us.
@@ -53,7 +55,9 @@ receive_callback (void *cls,
53 const char *message, 55 const char *message,
54 GNUNET_CronTime timestamp, GNUNET_CHAT_MSG_OPTIONS options) 56 GNUNET_CronTime timestamp, GNUNET_CHAT_MSG_OPTIONS options)
55{ 57{
56 fprintf (stdout, "%s: %s\n", senderNick, message); 58 g_print ("%s: %s\n", senderNick, message);
59 /*Write the message to the appropriate room...
60 * Somehow G wants me to do this without knowing which room it's headed to, but I don't see how...*/
57 return GNUNET_OK; 61 return GNUNET_OK;
58} 62}
59 63
@@ -62,22 +66,15 @@ init_chat ()
62{ 66{
63 GtkWidget *tab; 67 GtkWidget *tab;
64 GtkWidget *button; 68 GtkWidget *button;
65 GtkWidget *hbox;
66 69
67 priv_key = GNUNET_RSA_create_key (); 70 priv_key = GNUNET_RSA_create_key ();
68 GNUNET_RSA_get_public_key (priv_key, &pub_key); 71 GNUNET_RSA_get_public_key (priv_key, &pub_key);
69 72 /* Need to initialize ectx and cfg in here somehow... Still trying to figure that out.
70 g_print("g_print works!\n"); 73 * Once those are set up, the rest of this junk should be okay for now. (ingnoring memory leaks and such of course)
71 hbox = 74 */
72 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatHBox");
73
74 75
75 tab = 76 tab =
76 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebookvbox"); 77 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebookvbox");
77
78 button = gtk_button_new_with_label("hello world");
79
80 gtk_container_add(GTK_CONTAINER(tab), button);
81 78
82 gtk_widget_show (tab); 79 gtk_widget_show (tab);
83} 80}
@@ -112,6 +109,7 @@ create_chat_room_tab(char *room_name,char *nick)
112 GtkWidget *newChatWindow; 109 GtkWidget *newChatWindow;
113 GtkWidget *chatnotebook; 110 GtkWidget *chatnotebook;
114 GtkWidget *chatLabel; 111 GtkWidget *chatLabel;
112 struct GNUNET_CHAT_Room *chatRoom;
115 113
116 chatnotebook = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebook"); 114 chatnotebook = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebook");
117 chatXML = glade_xml_new (GNUNET_GTK_get_glade_filename (), "chatFrame",PACKAGE_NAME); 115 chatXML = glade_xml_new (GNUNET_GTK_get_glade_filename (), "chatFrame",PACKAGE_NAME);
@@ -123,7 +121,8 @@ create_chat_room_tab(char *room_name,char *nick)
123 121
124 gtk_widget_show (chatnotebook); 122 gtk_widget_show (chatnotebook);
125 123
126 GNUNET_CHAT_gui_join_room (nick,room_name,&pub_key,priv_key,&receive_callback,NULL); 124 chatRoom = GNUNET_CHAT_join_room (ectx,cfg,nick,room_name,&pub_key,priv_key,NULL,&receive_callback,NULL);
125
127 return 1; 126 return 1;
128} 127}
129 128
diff --git a/src/plugins/chat/chat.h b/src/plugins/chat/chat.h
new file mode 100644
index 00000000..2439398b
--- /dev/null
+++ b/src/plugins/chat/chat.h
@@ -0,0 +1,63 @@
1/*
2 This file is part of GNUnet.
3 (C) 2008 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @author Nathan Evans
23 * @file applications/chat/chat.h
24 **/
25#ifndef CHAT_H_
26#define CHAT_H_
27
28#include "platform.h"
29#include <GNUnet/gnunet_chat_lib.h>
30#include "../fs/meta.h"
31#include "../fs/meta.c"
32#include "platform.h"
33#include "gnunetgtk_common.h"
34
35void
36on_chat_room_name_button_click_event_chat(GtkWidget* widget, gpointer data);
37
38int
39create_chat_room_tab(char *room_name,char *nick);
40
41int
42remove_chat_room_tab(char *room_name);
43
44
45
46struct GNUNET_CHAT_gui_chat_client
47{
48 struct GNUNET_CHAT_gui_chat_client *next;
49 struct GNUNET_CHAT_gui_chat_client *prev;
50 int number;
51 GtkWidget *chatFrame;
52 struct GNUNET_CHAT_Room *room;
53
54};
55
56
57void
58on_chat_frame_send_button_click_event_chat(GtkWidget* widget, gpointer data);
59
60
61#endif /*CHAT_H_*/
62
63/* end of chat.h */