Author: dylan
Date: 2004-07-03 14:36:46 -0400 (Sat, 03 Jul 2004)
New Revision: 289

Removed:
   trunk/clients/irssi/src/core/haver-channels.c
   trunk/clients/irssi/src/core/haver-channels.h
Modified:
   trunk/clients/irssi/src/core/haver-login.c
   trunk/clients/irssi/src/core/haver-message.c
Log:
Bug fixes, removed borky channel code.



Deleted: trunk/clients/irssi/src/core/haver-channels.c
===================================================================
--- trunk/clients/irssi/src/core/haver-channels.c       2004-07-03 07:44:42 UTC 
(rev 288)
+++ trunk/clients/irssi/src/core/haver-channels.c       2004-07-03 18:36:46 UTC 
(rev 289)
@@ -1,153 +0,0 @@
-/*
- haver-channels.c : irssi
-
-    Copyright (C) 1999-2000 Timo Sirainen
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include "module.h"
-#include "signals.h"
-#include "misc.h"
-#include "levels.h"
-#include "channels-setup.h"
-
-#include "bans.h"
-#include "modes.h"
-#include "mode-lists.h"
-#include "haver-servers.h"
-#include "haver-channels.h"
-#include "haver-nicklist.h"
-#include "channel-rejoin.h"
-
-HAVER_CHANNEL_REC *haver_channel_create(HAVER_SERVER_REC *server, const char 
*name,
-                                   const char *visible_name, int automatic)
-{
-       HAVER_CHANNEL_REC *rec;
-
-       g_return_val_if_fail(server == NULL || IS_HAVER_SERVER(server), NULL);
-       g_return_val_if_fail(name != NULL, NULL);
-
-       rec = g_new0(HAVER_CHANNEL_REC, 1);
-       rec->no_modes = TRUE;
-
-       channel_init((CHANNEL_REC *) rec, (SERVER_REC *) server,
-                    name, visible_name, automatic);
-       return rec;
-}
-
-#define get_join_key(key) \
-       (((key) == NULL || *(key) == '\0') ? "x" : (key))
-
-static void haver_channels_join(HAVER_SERVER_REC *server, const char *data,
-                             int automatic)
-{
-       
-}
-
-/* function for finding HAVER channels - adds support for !channels */
-static CHANNEL_REC *haver_channel_find_server(SERVER_REC *server,
-                                           const char *channel)
-{
-       GSList *tmp;
-
-       for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
-               CHANNEL_REC *rec = tmp->data;
-
-               if (rec->chat_type != server->chat_type)
-                        continue;
-
-               /* check both !ABCDEchannel and !channel */
-               if (g_strcasecmp(channel, rec->name) == 0)
-                       return rec;
-
-               if (g_strcasecmp(channel, rec->visible_name) == 0)
-                       return rec;
-       }
-
-       return NULL;
-}
-
-static void sig_server_connected(SERVER_REC *server)
-{
-       if (!IS_HAVER_SERVER(server))
-               return;
-
-       server->channel_find_func = haver_channel_find_server;
-       server->channels_join = (void (*) (SERVER_REC *, const char *, int))
-               haver_channels_join;
-}
-
-static char *haver_get_join_data(CHANNEL_REC *channel)
-{
-       HAVER_CHANNEL_REC *haver_channel = (HAVER_CHANNEL_REC *) channel;
-
-       return haver_channel->key == NULL ? g_strdup(haver_channel->name) :
-                g_strconcat(haver_channel->name, " ", haver_channel->key, 
NULL);
-}
-
-static void sig_channel_created(HAVER_CHANNEL_REC *channel)
-{
-       if (IS_HAVER_CHANNEL(channel))
-                channel->get_join_data = haver_get_join_data;
-}
-
-static void sig_channel_destroyed(HAVER_CHANNEL_REC *channel)
-{
-       if (!IS_HAVER_CHANNEL(channel))
-                return;
-
-       if (!channel->server->disconnected && !channel->left && 
!channel->kicked) {
-               /* destroying channel record without actually
-                  having left the channel yet */
-               signal_emit("command part", 3, "", channel->server, channel);
-       }
-}
-
-void haver_channels_init(void)
-{
-       signal_add_first("server connected", (SIGNAL_FUNC) 
sig_server_connected);
-       signal_add("channel created", (SIGNAL_FUNC) sig_channel_created);
-       signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
-
-       channel_events_init();
-       channel_rejoin_init(); /* after channel_events_init() */
-        channels_query_init();
-       haver_channels_setup_init();
-
-       bans_init();
-        modes_init();
-       mode_lists_init();
-       massjoin_init();
-       haver_nicklist_init();
-}
-
-void haver_channels_deinit(void)
-{
-       signal_remove("server connected", (SIGNAL_FUNC) sig_server_connected);
-       signal_remove("channel created", (SIGNAL_FUNC) sig_channel_created);
-       signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
-
-       channel_events_deinit();
-       channel_rejoin_deinit();
-        channels_query_deinit();
-        haver_channels_setup_deinit();
-
-       bans_deinit();
-        modes_deinit();
-       mode_lists_deinit();
-       massjoin_deinit();
-       haver_nicklist_deinit();
-}

Deleted: trunk/clients/irssi/src/core/haver-channels.h
===================================================================
--- trunk/clients/irssi/src/core/haver-channels.h       2004-07-03 07:44:42 UTC 
(rev 288)
+++ trunk/clients/irssi/src/core/haver-channels.h       2004-07-03 18:36:46 UTC 
(rev 289)
@@ -1,31 +0,0 @@
-#ifndef __HAVER_CHANNELS_H
-#define __HAVER_CHANNELS_H
-
-#include "chat-protocols.h"
-#include "channels.h"
-
-/* Returns HAVER_CHANNEL_REC if it's HAVER channel, NULL if it isn't. */
-#define HAVER_CHANNEL(channel) \
-       PROTO_CHECK_CAST(CHANNEL(channel), HAVER_CHANNEL_REC, chat_type, 
"HAVER")
-
-#define IS_HAVER_CHANNEL(channel) \
-       (HAVER_CHANNEL(channel) ? TRUE : FALSE)
-
-#define STRUCT_SERVER_REC HAVER_SERVER_REC
-struct _HAVER_CHANNEL_REC {
-#include "channel-rec.h"
-
-       
-};
-
-void haver_channels_init(void);
-void haver_channels_deinit(void);
-
-/* Create new HAVER channel record */
-HAVER_CHANNEL_REC *haver_channel_create(HAVER_SERVER_REC *server, const char 
*name,
-                                   const char *visible_name, int automatic);
-
-#define haver_channel_find(server, name) \
-       HAVER_CHANNEL(channel_find(SERVER(server), name))
-
-#endif

Modified: trunk/clients/irssi/src/core/haver-login.c
===================================================================
--- trunk/clients/irssi/src/core/haver-login.c  2004-07-03 07:44:42 UTC (rev 
288)
+++ trunk/clients/irssi/src/core/haver-login.c  2004-07-03 18:36:46 UTC (rev 
289)
@@ -33,6 +33,7 @@
 #include "levels.h"
 #include "irssi-version.h"
 
+#define HAVER_VERSION 0.01
 
 static void event_want(HAVER_SERVER_REC *server, char *uid, char *cid, GSList 
*args)
 {
@@ -62,10 +63,11 @@
        msg = g_slist_append(msg, "IDENT");
        msg = g_slist_append(msg, uid);
        msg = g_slist_append(msg, "user");
-       msg = g_slist_append(msg, IRSSI_VERSION);
+       msg = g_slist_append(msg, "irssi-haver/" HAVER_VERSION " (irssi " 
IRSSI_VERSION ")");
 
        haver_send(server, msg);
 
+
        g_free(uid);
        g_slist_free(msg);
 }

Modified: trunk/clients/irssi/src/core/haver-message.c
===================================================================
--- trunk/clients/irssi/src/core/haver-message.c        2004-07-03 07:44:42 UTC 
(rev 288)
+++ trunk/clients/irssi/src/core/haver-message.c        2004-07-03 18:36:46 UTC 
(rev 289)
@@ -23,7 +23,6 @@
 #include "rawlog.h"
 #include "haver-message.h"
 #include "haver-protocol.h"
-#include "haver-channels.h"
 
 #include "haver-servers.h"
 #include "line-split.h"
@@ -34,26 +33,6 @@
 #include "levels.h"
 #include "irssi-version.h"
 
-HAVER_CHANNEL_REC *haver_channel_create(HAVER_SERVER_REC *server, const char 
*name,
-                                   const char *visible_name, int automatic)
-{
-       HAVER_CHANNEL_REC *rec;
-
-       g_return_val_if_fail(server == NULL || IS_HAVER_SERVER(server), NULL);
-       g_return_val_if_fail(name != NULL, NULL);
-
-       rec = g_new0(HAVER_CHANNEL_REC, 1);
-       rec->no_modes = TRUE;
-
-       channel_init((CHANNEL_REC *) rec, (SERVER_REC *) server,
-                    name, visible_name, automatic);
-       return rec;
-}
-
-#define get_join_key(key) \
-       (((key) == NULL || *(key) == '\0') ? "x" : (key))
-
-
 static void event_msg(HAVER_SERVER_REC *server, char *uid, char *cid, GSList 
*args)
 {
 /*     char *type  = (char *) args->data; */
@@ -70,20 +49,32 @@
 static void event_join(HAVER_SERVER_REC *server, char *uid, char *cid, GSList 
*args)
 {
        /* "message join", SERVER_REC, char *channel, char *nick, char *address 
*/
-
-       haver_channel_create(server, cid, cid, 1);
+       g_assert(uid != NULL);
+       g_assert(cid != NULL);
+       
        signal_emit("message join", 4, server, cid, uid, "haver");
 }
 
+static void event_part(HAVER_SERVER_REC *server, char *uid, char *cid, GSList 
*args)
+{      
+       /* "message part", SERVER_REC, char *channel, char *nick, char *address 
*/
+       g_assert(uid != NULL);
+       g_assert(cid != NULL);
+       
+       signal_emit("message part", 4, server, cid, uid, "haver");
+}
 
+
 void haver_message_init(void)
 {
        signal_add("haver event msg", (SIGNAL_FUNC) event_msg);
        signal_add("haver event join", (SIGNAL_FUNC) event_join);
+       signal_add("haver event part", (SIGNAL_FUNC) event_part);
 }
 
 void haver_message_deinit(void)
 {
        signal_remove("haver event msg", (SIGNAL_FUNC) event_msg);
        signal_remove("haver event join", (SIGNAL_FUNC) event_join);
+       signal_remove("haver event part", (SIGNAL_FUNC) event_part);
 }


Reply via email to