changeset 179:8d8faeab01f6

[gaim-migrate @ 189] Added a TOC interface plugin. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 26 Apr 2000 02:49:59 +0000
parents 5d62a5d50c89
children 0ff9f19b9b23
files plugins/Makefile.am plugins/filectl.c plugins/toc_commands.c
diffstat 3 files changed, 51 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/Makefile.am	Wed Apr 26 01:29:21 2000 +0000
+++ b/plugins/Makefile.am	Wed Apr 26 02:49:59 2000 +0000
@@ -10,4 +10,4 @@
 plugin_DATA = autorecon.so iconaway.so spellchk.so
 plugindir = $(libdir)/gaim
 EXTRA_DIST = CRAZY HOWTO SIGNALS autorecon.c chkmail.c filectl.c gaiminc.c \
-	iconaway.c simple.c spellchk.c
+	iconaway.c simple.c spellchk.c toc_commands.c
--- a/plugins/filectl.c	Wed Apr 26 01:29:21 2000 +0000
+++ b/plugins/filectl.c	Wed Apr 26 02:49:59 2000 +0000
@@ -9,12 +9,12 @@
 #include <string.h>
 #include <ctype.h>
 
-void *handle;
-int check;
-time_t mtime;
+static void *handle;
+static int check;
+static time_t mtime;
 
-void init_file();
-void check_file();
+static void init_file();
+static void check_file();
 
 extern void dologin(GtkWidget *, GtkWidget *);
 extern void do_quit();
@@ -36,7 +36,8 @@
 	while (fgets(buffer, sizeof buffer, file)) {
 		if (buffer[strlen(buffer) - 1] == '\n')
 			buffer[strlen(buffer) - 1] = 0;
-		printf("read: %s\n", buffer);
+		sprintf(debug_buff, "read: %s\n", buffer);
+		debug_print(debug_buff);
 		command = getarg(buffer, 0, 0);
 		if        (!strncasecmp(command, "signon", 6)) {
 			if (!blist) {
@@ -116,8 +117,11 @@
 	sprintf(file, "%s/.gaim/control", getenv("HOME"));
 
 	if ((stat (file, &finfo) == 0) && (finfo.st_size > 0))
-		if (mtime != finfo.st_mtime)
+		if (mtime != finfo.st_mtime) {
+			sprintf(debug_buff, "control changed, checking\n");
+			debug_print(debug_buff);
 			run_commands();
+		}
 }
 
 char *getarg(char *line, int which, int remain) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/toc_commands.c	Wed Apr 26 02:49:59 2000 +0000
@@ -0,0 +1,39 @@
+#define GAIM_PLUGINS
+#include "gaim.h"
+
+#include <gtk/gtk.h>
+
+void enter_callback(GtkWidget *widget, GtkWidget *entry) {
+	gchar *entry_text;
+	entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
+	sflap_send(entry_text, strlen(entry_text), TYPE_DATA);
+}
+
+GtkWidget *window;
+void gaim_plugin_init(void *h) {
+	GtkWidget *entry;
+
+	window = gtk_window_new(GTK_WINDOW_DIALOG);
+	gtk_window_set_title(GTK_WINDOW(window), "Gaim - SFLAP interface");
+
+	entry = gtk_entry_new();
+	gtk_signal_connect(GTK_OBJECT(entry), "activate",
+			   (GtkSignalFunc)enter_callback,
+			   entry);
+	gtk_container_add(GTK_CONTAINER(window), entry);
+	gtk_widget_show(entry);
+
+	gtk_widget_show(window);
+}
+
+void gaim_plugin_remove() {
+	gtk_widget_destroy(window);
+}
+
+char *name() {
+	return "TOC Interface";
+}
+
+char *description() {
+	return "Allows you to talk directly to the TOC server, bypassing gaim.";
+}