Index: .cvsignore =================================================================== RCS file: /cvsroot/gaim-snpp/gaim-snpp/.cvsignore,v retrieving revision 1.2 diff -u -p -u -p -r1.2 .cvsignore --- .cvsignore 25 May 2004 03:34:43 -0000 1.2 +++ .cvsignore 19 Jul 2004 15:10:54 -0000 @@ -16,3 +16,4 @@ ltmain.sh missing mkinstalldirs gaim-snpp-*.exe +gaim-snpp.spec Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-snpp/gaim-snpp/Makefile.am,v retrieving revision 1.2 diff -u -p -u -p -r1.2 Makefile.am --- Makefile.am 25 May 2004 03:34:43 -0000 1.2 +++ Makefile.am 19 Jul 2004 15:10:54 -0000 @@ -5,7 +5,8 @@ EXTRA_DIST = \ NEWS \ PROTOCOL \ README \ - VERSION + VERSION \ + gaim-snpp.spec SUBDIRS = src pixmaps Index: configure.ac =================================================================== RCS file: /cvsroot/gaim-snpp/gaim-snpp/configure.ac,v retrieving revision 1.5 diff -u -p -u -p -r1.5 configure.ac --- configure.ac 24 Jun 2004 13:59:30 -0000 1.5 +++ configure.ac 19 Jul 2004 15:10:54 -0000 @@ -75,12 +75,14 @@ AM_CONDITIONAL(PLUGINS, test "$want_plug # Setup libtool # AM_PROG_LIBTOOL +LIBTOOL="$LIBTOOL --silent" # # Finish up # AM_CONFIG_HEADER(pre_config.h) AC_OUTPUT([Makefile + gaim-snpp.spec pixmaps/Makefile src/Makefile ]) Index: gaim-snpp.spec.in =================================================================== RCS file: gaim-snpp.spec.in diff -N gaim-snpp.spec.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gaim-snpp.spec.in 19 Jul 2004 15:10:54 -0000 @@ -0,0 +1,56 @@ +%define rpmrelease 0 +Summary: Simple Network Paging Protocol plugin for Gaim +Name: @PACKAGE@ +Version: @VERSION@ +Release: %{gaimver}%{?gaimdist:.%{gaimdist}}.%{rpmrelease} +License: GPL +Group: Applications/Internet +Url: http://gaim-snpp.sourceforge.net/ +Source: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +Requires: gaim = 1:%{gaimver} +BuildRequires: pkgconfig, libtool, gaim-devel + +%description +gaim-snpp is a protocol plug-in for Gaim that allows sending messages to pager +servers (like sendpage, beepage, or qpage) via the Simple Network Paging +Protocol ("SNPP" - RFC 1861), basically turning Gaim into an SNPP client. So +far SNPP Level 1 only. + +To rebuild for a specific Gaim version or dist tag: +rpmbuild --rebuild @PACKAGE@-@VERSION@-%{rpmrelease}.src.rpm --define 'gaimver %{gaimver}' --define 'gaimdist fc1' + +%prep +%setup -q + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} + +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{_prefix} bindir=$RPM_BUILD_ROOT%{_bindir} \ + datadir=$RPM_BUILD_ROOT%{_datadir} includedir=$RPM_BUILD_ROOT%{_includedir} \ + libdir=$RPM_BUILD_ROOT%{_libdir} mandir=$RPM_BUILD_ROOT%{_mandir} \ + sysconfdir=$RPM_BUILD_ROOT%{_sysconfdir} \ + install + +strip $RPM_BUILD_ROOT%{_libdir}/gaim/*.so || : +rm -f $RPM_BUILD_ROOT%{_libdir}/gaim/libsnpp.la $RPM_BUILD_ROOT%{_libdir}/gaim/libsnpp.a + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc README ChangeLog +%{_libdir}/gaim/libsnpp.so +%{_datadir}/pixmaps/gaim/status/default/* + +%changelog +* Mon Jul 19 2004 Stu Tomlinson +- Initial spec file Index: src/Makefile.am =================================================================== RCS file: /cvsroot/gaim-snpp/gaim-snpp/src/Makefile.am,v retrieving revision 1.4 diff -u -p -u -p -r1.4 Makefile.am --- src/Makefile.am 24 Jun 2004 13:59:30 -0000 1.4 +++ src/Makefile.am 19 Jul 2004 15:10:54 -0000 @@ -1,20 +1,18 @@ plugindir = $(libdir)/gaim -snpp_la_LDFLAGS = -module -avoid-version +libsnpp_la_LDFLAGS = -module -avoid-version if PLUGINS -plugin_LTLIBRARIES = snpp.la +plugin_LTLIBRARIES = libsnpp.la + +libsnpp_la_SOURCES = snpp.c -snpp_la_SOURCES = snpp.c - endif AM_CPPFLAGS = \ -DLIBDIR=\"$(libdir)/gaim/\" \ -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ $(GLIB_CFLAGS) \ $(GAIM_CFLAGS) \ $(DEBUG_CFLAGS) Index: src/snpp.c =================================================================== RCS file: /cvsroot/gaim-snpp/gaim-snpp/src/snpp.c,v retrieving revision 1.21 diff -u -p -u -p -r1.21 snpp.c --- src/snpp.c 13 Jul 2004 18:23:51 -0000 1.21 +++ src/snpp.c 19 Jul 2004 15:10:54 -0000 @@ -41,7 +41,7 @@ #define SNPP_WEBSITE "http://gaim-snpp.sourceforge.net" -#define SNPP_DEFAULT_SERVER "" +#define SNPP_DEFAULT_SERVER "localhost" #define SNPP_DEFAULT_PORT 444 #define SNPP_INITIAL_BUFSIZE 1024 @@ -51,9 +51,9 @@ enum state { CONN, CALL, PAGE, MESS, SEN struct snpp_data { GaimAccount *account; int fd; - + struct snpp_page *current_page; - //GQueue *page_queue; + /* GQueue *page_queue; */ }; struct snpp_page { @@ -66,8 +66,10 @@ static GaimPlugin *_snpp_plugin = NULL; static struct snpp_page *snpp_page_new() { + struct snpp_page *sp; + gaim_debug_info("snpp", "snpp_page_new\n"); - struct snpp_page *sp = g_new0(struct snpp_page, 1); + sp = g_new0(struct snpp_page, 1); sp->state = CONN; return sp; }; @@ -107,7 +109,7 @@ static void snpp_reset(GaimConnection *g if (sd->current_page != NULL) snpp_page_destroy(sd->current_page); - //g_queue_free(sd->page_queue); + /* g_queue_free(sd->page_queue); */ } /* @@ -126,33 +128,36 @@ static int snpp_cmd_call(struct snpp_dat static int snpp_cmd_page(struct snpp_data *sd) { + char command[SNPP_INITIAL_BUFSIZE]; + gaim_debug_info("snpp", "snpp_cmd_page\n"); - char command[SNPP_INITIAL_BUFSIZE]; sd->current_page->state = PAGE; sprintf(command, "PAGE %s\n", sd->current_page->pager); snpp_send(sd->fd, command); return 0; }; - + static int snpp_cmd_mess(struct snpp_data *sd) { + char command[SNPP_INITIAL_BUFSIZE]; + gaim_debug_info("snpp", "snpp_cmd_mess\n"); - char command[SNPP_INITIAL_BUFSIZE]; sd->current_page->state = MESS; sprintf(command, "MESS %s\n", sd->current_page->message); snpp_send(sd->fd, command); return 0; }; - + static int snpp_cmd_send(struct snpp_data *sd) { + char command[SNPP_INITIAL_BUFSIZE]; + gaim_debug_info("snpp", "snpp_cmd_send\n"); - char command[SNPP_INITIAL_BUFSIZE]; sd->current_page->state = SEND; sprintf(command, "SEND\n"); snpp_send(sd->fd, command); @@ -162,9 +167,10 @@ static int snpp_cmd_send(struct snpp_dat static int snpp_cmd_quit(struct snpp_data *sd) { + char command[SNPP_INITIAL_BUFSIZE]; + gaim_debug_info("snpp", "snpp_cmd_quit\n"); - char command[SNPP_INITIAL_BUFSIZE]; sd->current_page->state = QUIT; sprintf(command, "QUIT\n"); snpp_send(sd->fd, command); @@ -174,18 +180,21 @@ static int snpp_cmd_quit(struct snpp_dat static void snpp_callback(gpointer data, gint source, GaimInputCondition cond) { - gaim_debug_info("snpp", "snpp_callback\n"); - - GaimConnection *gc = data; - struct snpp_data *sd = gc->proto_data; + GaimConnection *gc; + struct snpp_data *sd; int len; char buf[SNPP_INITIAL_BUFSIZE]; char *retcode = NULL; GaimConversation *conv; + gaim_debug_info("snpp", "snpp_callback\n"); + + gc = data; + sd = gc->proto_data; + if ((len = read(sd->fd, buf, SNPP_INITIAL_BUFSIZE - 1)) < 0) { gaim_debug_warning("snpp", "snpp_callback: Read error\n"); - // gaim_connection_error(gc, _("Read error")); + /* gaim_connection_error(gc, _("Read error")); */ return; } else if (len == 0) { /* Remote closed the conection, probably */ @@ -242,7 +251,7 @@ static void snpp_callback(gpointer data, gaim_debug_info("snpp", "snpp_callback: State is SEND, return code was %s\n", retcode); if (!g_ascii_strcasecmp(retcode,"250")) { /* Print status message (buf) to window */ - if (conv = gaim_find_conversation_with_account(sd->current_page->pager, sd->account)) { + if ((conv = gaim_find_conversation_with_account(sd->current_page->pager, sd->account))) { gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); } snpp_cmd_quit(sd); @@ -269,7 +278,7 @@ static void snpp_callback(gpointer data, } g_free(retcode); - + /* * Pop another sp off the head of the queue and into current_page, * and call snpp_process again. @@ -284,10 +293,15 @@ static void snpp_callback(gpointer data, static void snpp_connect_cb(gpointer data, gint source, GaimInputCondition cond) { + GaimConnection *gc; + struct snpp_data *sd; + GList *connections; + gaim_debug_info("snpp", "snpp_connect_cb\n"); - GaimConnection *gc = data; - struct snpp_data *sd = gc->proto_data; - GList *connections = gaim_connections_get_all(); + + gc = data; + sd = gc->proto_data; + connections = gaim_connections_get_all(); if (source < 0) return; @@ -304,9 +318,10 @@ static void snpp_connect_cb(gpointer dat static void snpp_connect(GaimConnection *gc) { - gaim_debug_info("snpp", "snpp_connect\n"); int err; + gaim_debug_info("snpp", "snpp_connect\n"); + err = gaim_proxy_connect(gc->account, gaim_account_get_string(gc->account, "server", SNPP_DEFAULT_SERVER), gaim_account_get_int(gc->account, "port", SNPP_DEFAULT_PORT), @@ -343,9 +358,12 @@ static int snpp_send_im(GaimConnection * const char *what, GaimConvImFlags imflags) { + struct snpp_data *sd; + struct snpp_page *sp; + gaim_debug_info("snpp", "snpp_send_im\n"); - struct snpp_data *sd = gc->proto_data; - struct snpp_page *sp = snpp_page_new(); + sd = gc->proto_data; + sp = snpp_page_new(); sp->pager = g_strdup(who); sp->message = g_strdup(what); @@ -369,20 +387,21 @@ static int snpp_send_im(GaimConnection * static const char *snpp_icon(GaimAccount *a, GaimBuddy *b) { - // gaim_debug_info("snpp", "snpp_icon\n"); + /* gaim_debug_info("snpp", "snpp_icon\n"); */ return "snpp"; } static void snpp_login(GaimAccount *account) { - gaim_debug_info("snpp", "snpp_login\n"); GaimConnection *gc; struct snpp_data *sd; + gaim_debug_info("snpp", "snpp_login\n"); + gc = gaim_account_get_connection(account); gc->proto_data = sd = g_new0(struct snpp_data, 1); sd->account = account; - //sd->page_queue = g_queue_new(); + /* sd->page_queue = g_queue_new(); */ gaim_connection_set_state(gc, GAIM_CONNECTED); serv_finish_login(gc); @@ -391,8 +410,10 @@ static void snpp_login(GaimAccount *acco static void snpp_close(GaimConnection *gc) { + struct snpp_data *sd; gaim_debug_info("snpp", "snpp_close\n"); - struct snpp_data *sd = gc->proto_data; + + sd = gc->proto_data; if (sd == NULL) return; @@ -483,7 +504,7 @@ static GaimPluginInfo info = NULL, /* dependencies */ GAIM_PRIORITY_DEFAULT, /* priority */ "prpl-snpp", /* id */ - "SNPP", /* name */ + "SNPP", /* name */ SNPP_VERSION, /* version */ N_("SNPP Plugin"), /* summary */ N_("Allows Gaim to send messages over the Simple Network Paging Protocol."), /* description */ @@ -495,7 +516,7 @@ static GaimPluginInfo info = NULL, /* ui_info */ &prpl_info, /* extra_info */ NULL, /* prefs_info */ - NULL /* actions */ + NULL /* actions */ };