#include <fcntl.h>
#include "xmpp.h"
#include "message.h"
+#include "presence.h"
static int fd;
static GtkWidget *textview;
static GtkWidget *entry_to;
static GtkWidget *entry_body;
+static GtkWidget *entry_status;
static void
hc_xmpp_chat (hc_xmpp_t *xmpp, iks *message)
hc_xmpp_send_message (xmpp, to, body);
}
+static void
+hc_xmpp_chat_status (GtkWidget *button, gpointer data)
+{
+ hc_xmpp_t* xmpp;
+ char *status;
+ xmpp = (hc_xmpp_t *) data;
+ status = (char *) gtk_entry_get_text (GTK_ENTRY (entry_status));
+ hc_xmpp_send_presence (xmpp, NULL, NULL, status);
+}
+
void
hc_xmpp_chat_open (hc_xmpp_t *xmpp)
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *hbox;
+ GtkWidget *hbox2;
GtkWidget *button;
+ GtkWidget *button2;
fd = open ("/home/cascardo/.hcxmpp/log", O_RDWR | O_APPEND | O_CREAT);
if (fd < 0)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
vbox = gtk_vbox_new (FALSE, 5);
hbox = gtk_hbox_new (FALSE, 5);
+ hbox2 = gtk_hbox_new (FALSE, 5);
entry_to = gtk_entry_new ();
entry_body = gtk_entry_new ();
+ entry_status = gtk_entry_new ();
button = gtk_button_new_with_label ("Send");
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (hc_xmpp_chat_send), xmpp);
+ button2 = gtk_button_new_with_label ("Change Status");
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hc_xmpp_chat_status), xmpp);
textview = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD_CHAR);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox), textview);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_container_add (GTK_CONTAINER (vbox), hbox2);
gtk_container_add (GTK_CONTAINER (hbox), entry_to);
gtk_container_add (GTK_CONTAINER (hbox), entry_body);
gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_container_add (GTK_CONTAINER (hbox2), entry_status);
+ gtk_container_add (GTK_CONTAINER (hbox2), button2);
gtk_widget_show_all (window);
hc_xmpp_set_msg_hook (xmpp, hc_xmpp_chat);
hc_xmpp_set_sent_msg_hook (xmpp, hc_xmpp_chat);