Author: nevans Date: 2008-03-04 21:58:55 -0700 (Tue, 04 Mar 2008) New Revision: 6535
Modified: gnunet-gtk/src/plugins/chat/Makefile gnunet-gtk/src/plugins/chat/Makefile.am gnunet-gtk/src/plugins/chat/chat.c Log: Modified: gnunet-gtk/src/plugins/chat/Makefile =================================================================== --- gnunet-gtk/src/plugins/chat/Makefile 2008-03-04 07:53:27 UTC (rev 6534) +++ gnunet-gtk/src/plugins/chat/Makefile 2008-03-05 04:58:55 UTC (rev 6535) @@ -233,7 +233,9 @@ libgnunetgtkmodule_chat_la_LIBADD = \ $(top_builddir)/src/common/libgnunetgtk_common.la \ - -lgnunetutil -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 + -lgnunetutil \ + -lgnunetchat_api \ + -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 libgnunetgtkmodule_chat_la_LDFLAGS = \ -export-dynamic -avoid-version -module Modified: gnunet-gtk/src/plugins/chat/Makefile.am =================================================================== --- gnunet-gtk/src/plugins/chat/Makefile.am 2008-03-04 07:53:27 UTC (rev 6534) +++ gnunet-gtk/src/plugins/chat/Makefile.am 2008-03-05 04:58:55 UTC (rev 6535) @@ -14,7 +14,9 @@ libgnunetgtkmodule_chat_la_LIBADD = \ $(top_builddir)/src/common/libgnunetgtk_common.la \ - -lgnunetutil @GTK_LIBS@ @GNUNETGTK_LIBS@ + -lgnunetutil \ + -lgnunetchat_api \ + @GTK_LIBS@ @GNUNETGTK_LIBS@ libgnunetgtkmodule_chat_la_LDFLAGS = \ -export-dynamic -avoid-version -module Modified: gnunet-gtk/src/plugins/chat/chat.c =================================================================== --- gnunet-gtk/src/plugins/chat/chat.c 2008-03-04 07:53:27 UTC (rev 6534) +++ gnunet-gtk/src/plugins/chat/chat.c 2008-03-05 04:58:55 UTC (rev 6535) @@ -30,9 +30,18 @@ const GNUNET_RSA_PublicKey pub_key; const struct GNUNET_RSA_PrivateKey *priv_key; -struct GNUNET_GE_Context *ectx; -struct GNUNET_GC_Configuration *cfg; +static struct GNUNET_ClientServerConnection *sock; + +static struct GNUNET_Mutex *lock; + +static struct GNUNET_CronManager *cron; + +static struct GNUNET_GE_Context *chat_ectx; + +static struct GNUNET_GC_Configuration *chat_cfg; + + /** * A message was sent in the chat to us. * @@ -62,16 +71,22 @@ } void -init_chat () +init_chat (struct GNUNET_GE_Context *ectx, + struct GNUNET_GC_Configuration *cfg) { GtkWidget *tab; - GtkWidget *button; + + chat_ectx = ectx; + chat_cfg = cfg; + /*GNUNET_disable_entropy_gathering ();*/ + /* FIXME: yes G, read key from disk */ priv_key = GNUNET_RSA_create_key (); GNUNET_RSA_get_public_key (priv_key, &pub_key); - /* Need to initialize ectx and cfg in here somehow... Still trying to figure that out. - * Once those are set up, the rest of this junk should be okay for now. (ingnoring memory leaks and such of course) - */ + + sock = GNUNET_client_connection_create (chat_ectx, chat_cfg); + lock = GNUNET_mutex_create (GNUNET_NO); + cron = GNUNET_GTK_get_cron_manager (); tab = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebookvbox"); @@ -121,7 +136,8 @@ gtk_widget_show (chatnotebook); - chatRoom = GNUNET_CHAT_join_room (ectx,cfg,nick,room_name,&pub_key,priv_key,NULL,&receive_callback,NULL); + /* We do a silly strdup later on member_info... either check for NULL or only pass "" for member_info!! */ + chatRoom = GNUNET_CHAT_join_room (chat_ectx,chat_cfg,nick,room_name,&pub_key,priv_key,"",&receive_callback,NULL); return 1; } @@ -133,5 +149,33 @@ return -1; } +void +on_chat_frame_send_button_click_event_chat(GtkWidget* widget, gpointer data) +{ + GtkWidget *chatnotebook; + GtkWidget *chatvbox; + GtkWidget *chatlabel; + GtkWidget *curr_page; + gchar *room_name; + + + chatnotebook = gtk_widget_get_ancestor (widget,GTK_TYPE_NOTEBOOK); + curr_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(chatnotebook),gtk_notebook_get_current_page(GTK_NOTEBOOK(chatnotebook))); + chatlabel = gtk_notebook_get_tab_label (GTK_NOTEBOOK(chatnotebook),curr_page); + + room_name = gtk_label_get_text(GTK_LABEL(chatlabel)); + + g_print("Label of current tab is %s\n",room_name); + + /* Almost there... need to find room in linked list (provided it exists!) + * before sending out the message... + */ + /*GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, + const char *message, + GNUNET_CHAT_MessageConfirmation callback, + void *cls, + GNUNET_CHAT_MSG_OPTIONS options, + const GNUNET_RSA_PublicKey * receiver);*/ +} /* end of chat.c */ _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn