Some more fixes
authorjelmer <jelmer>
Fri, 28 Oct 2005 12:48:31 +0000 (14:48 +0200)
committerjelmer <jelmer>
Fri, 28 Oct 2005 12:48:31 +0000 (14:48 +0200)
.bzrignore
HACKING
client.c
mods/repl_none.c
mods/repl_simple.c
motd
redirect.c
state.c

index 1e31fae4b2b980324095b005b1ff970e69963544..d9fde912e3a68752657722947424495feea99688 100644 (file)
@@ -43,3 +43,4 @@ rfctester/ircdtorture
 rfctester/test-*.so
 testsuite/*.so
 testsuite/ctrlproxyrc.torture
+testsuite/torture
diff --git a/HACKING b/HACKING
index b54efe387f25cc681b6f7b43d6153dfaec145121..583d63b512160f6686a047caf3610b0fe2afe131 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -3,7 +3,11 @@ Written by Jelmer Vernooij, 2003
 
 General
 -------
+The core of ctrlproxy is in the top source directory, standard module
+are in mods/.
 
+Writing Modules
+---------------
 As has been said in the introduction, ctrlproxy 
 is easily extendible. At the time of writing, there 
 are nine modules available.
index e2be70c3f994cf1e01d0366b5a1be0ecc62ab510..4bc7d82f603de854e01871776f6e3d66b11b009f 100644 (file)
--- a/client.c
+++ b/client.c
@@ -323,26 +323,24 @@ static gboolean welcome_client(struct client *client)
 
        g_assert(client->nick);
        g_assert(client->network);
-       g_assert(client->network->state);
-
-       if (g_strcasecmp(client->nick, client->network->state->me.nick)) {
-               /* Tell the client our his/her real nick */
-               char *tmp = g_strdup_printf("%s!~%s@%s", 
-                                                                       client->nick, 
-                                                                       client->username, 
-                                                                       client->hostname);
-               client_send_args_ex(client, tmp, "NICK", client->network->state->me.nick, NULL); 
-               g_free(tmp);
-
-               /* Try to get the nick the client specified */
-               if (!client->network->config->ignore_first_nick) {
-                       network_send_args(client->network, "NICK", client->nick, NULL);
+
+       if (client->network->state) {
+               if (g_strcasecmp(client->nick, client->network->state->me.nick)) {
+                       /* Tell the client our his/her real nick */
+                       char *tmp = g_strdup_printf("%s!~%s@%s", 
+                                                                               client->nick, 
+                                                                               client->username, 
+                                                                               client->hostname);
+                       client_send_args_ex(client, tmp, "NICK", client->network->state->me.nick, NULL); 
+                       g_free(tmp);
+
+                       /* Try to get the nick the client specified */
+                       if (!client->network->config->ignore_first_nick) {
+                               network_send_args(client->network, "NICK", client->nick, NULL);
+                       }
                }
        }
 
-       g_free(client->nick);
-       client->nick = NULL;
-
        if(!new_client_hook_execute(client)) {
                disconnect_client(client, "Refused by client connect hook");
                return FALSE;
index e3c3de2acdde7ad5f07960485736305d5baac6e1..893b7558ba590e1cfc34703599d274a43546756f 100644 (file)
@@ -22,7 +22,8 @@
 
 static gboolean none_replicate(struct client *c, void *userdata)
 {
-       client_send_state(c, c->network->state);
+       if (c->network->state)
+               client_send_state(c, c->network->state);
        return TRUE;
 }
 
index 65f9adc039e005eff8e0de432130a4ed6de1bfae..1fafea23905103c9556fc090f4d4e875211a8f30 100644 (file)
@@ -24,7 +24,13 @@ static GHashTable *simple_backlog = NULL;
 
 static void change_nick(struct client *c, const char *newnick) 
 {
-       struct line *l = irc_parse_line_args(c->network->state->me.hostmask, "NICK", newnick, NULL);
+       struct line *l;
+       g_assert(c);
+       g_assert(newnick);
+
+       g_assert(c->network->state);
+       
+       l = irc_parse_line_args(c->network->state->me.hostmask, "NICK", newnick, NULL);
        client_send_line(c, l);
        free_line(l);
 }
@@ -48,8 +54,10 @@ static gboolean simple_replicate(struct client *c, void *userdata)
 
        m = g_hash_table_lookup(simple_backlog, c->network);
        ns = linestack_get_state(c->network, m);
-       client_send_state(c, ns);
-       change_nick(c, ns->me.nick);
+       if (ns) {
+               client_send_state(c, ns);
+               change_nick(c, ns->me.nick);
+       }
        free_network_state(ns);
        linestack_send(c->network, m, NULL, c);
        return TRUE;
diff --git a/motd b/motd
index 9ace2ca0e1be9345e419db6ce8b6126406bcf4ca..deb7d378a63028f7f0f902083c9c1bbaa21a8b49 100644 (file)
--- a/motd
+++ b/motd
@@ -1,7 +1,8 @@
-Welcome to the ControlProxy!
+Welcome to the ControlProxy! 
+URL: http://ctrlproxy.vernstok.nl/
 
-(C) 2002-2005 by Jelmer Vernooij <jelmer@vernstok.nl> and others
-  for a list of contributions, see AUTHORS
+(C) 2002-2005 by Jelmer Vernooij <jelmer@vernstok.nl> and others.
+For a list of contributions, see AUTHORS.
 
 Use /CTRLPROXY HELP or /MSG CTRLPROXY HELP to get 
 a list of available commands.
index 4c99a181b2f1f6105d479a99342448e5ac43b235..5380cf6a41879b8e5a9a10e128afbe0eba34df7a 100644 (file)
@@ -1,6 +1,6 @@
 /* 
        ctrlproxy: A modular IRC proxy
-       mux: Send numerics to the right places
+       Send numerics to the right places
        (c) 2002-2005 Jelmer Vernooij <jelmer@nl.linux.org>
 
        This program is free software; you can redistribute it and/or modify
diff --git a/state.c b/state.c
index 6b388e81e375898b55bf01b7cf98d72a4e9d97f6..1c4f609449a7ed4a2a4aca82f6df59ee703f24a1 100644 (file)
--- a/state.c
+++ b/state.c
@@ -820,6 +820,9 @@ void free_network_nick(struct network_state *st, struct network_nick *nn)
 
 void free_network_state(struct network_state *state)
 {
+       if (state == NULL)
+               return;
+
        while(state->channels)
        {
                free_channel((struct channel_state *)state->channels->data);