summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--docs/IRCD9
-rw-r--r--include/extern.h2
-rw-r--r--include/services.h23
-rw-r--r--src/bahamut.c7
-rw-r--r--src/channels.c4
-rw-r--r--src/dreamforge.c1
-rw-r--r--src/hybrid.c7
-rw-r--r--src/plexus.c7
-rw-r--r--src/ptlink.c1
-rw-r--r--src/rageircd.c7
-rw-r--r--src/ratbox.c1
-rw-r--r--src/servers.c39
-rw-r--r--src/shadowircd.c7
-rw-r--r--src/solidircd.c7
-rw-r--r--src/ultimate2.c1
-rw-r--r--src/ultimate3.c18
-rw-r--r--src/unreal31.c1
-rw-r--r--src/unreal32.c7
-rw-r--r--src/viagra.c7
-rw-r--r--version.log6
21 files changed, 111 insertions, 52 deletions
diff --git a/Changes b/Changes
index 078371020..811089929 100644
--- a/Changes
+++ b/Changes
@@ -8,6 +8,7 @@ Provided by Anope Dev. <dev@anope.org> - 2005
02/13 A Internal Event support, see EVENTS in the doc folder for help [ #00]
02/05 A Support for Unreal 3.2 +I channel mode. [ #00]
02/03 A Merged anope-win32 branch into the main, now Win32 ready. [ #00]
+03/14 F Sync state of servers was not recorded reliable enough. [ #00]
03/12 F Services setting already set channel modes. [ #00]
03/12 F Not displaying entrymessage/greets on (re-)sync of uplink anymore.[ #00]
03/12 F Sync state for uplink server not being set correctly. [ #00]
diff --git a/docs/IRCD b/docs/IRCD
index bb5849547..132b77c1b 100644
--- a/docs/IRCD
+++ b/docs/IRCD
@@ -430,16 +430,21 @@ How To Add IRCd Support
84) P10: Is this IRCd a P10-style IRCd? Use 1 for yes, 0 for no.
- 83) Character Set: Unreal passes the character set during PROTOCTL,
+ 85) Character Set: Unreal passes the character set during PROTOCTL,
the value is stored here. Set this NULL to start.
+ 86) Reports sync: Does the IRCd report when it's in sync (or done bursting,
+ depending on how you want to say it)? Remember to set
+ the sync state for servers correctly if it does.
+ Use 1 for yes, 0 for no.
+
So we've had this long list. Now there's a second struct to fill. This
struct isn't as long as the previous one though, so we'll handle it quite
quick compared to the previous one.
IRCDCAPAB ircdcap[] = { }
- This struct is based oN the CAPAB defines. You should review the CAPAB
+ This struct is based on the CAPAB defines. You should review the CAPAB
table below to see how this should be done.
Define Table
diff --git a/include/extern.h b/include/extern.h
index 1ddf6ecf6..1f2928c88 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -808,12 +808,14 @@ E void notice_help(char *source, User *dest, int message, ...);
E Server *servlist;
E Server *me_server;
+E Server *serv_uplink;
E uint32 uplink_capab;
E Server *first_server(int flags);
E Server *next_server(int flags);
E int is_ulined(char *server);
+E int is_sync(Server *server);
E Server *new_server(Server * uplink, const char *name, const char *desc,
uint16 flags, char *suid);
diff --git a/include/services.h b/include/services.h
index 51b9d3075..09a2682ca 100644
--- a/include/services.h
+++ b/include/services.h
@@ -335,6 +335,7 @@ struct ircdvars_ {
int supporthelper; /* +h helper umodes */
int p10; /* ircd is P10 */
char *nickchars; /* character set */
+ int sync; /* reports sync state */
};
struct ircdcapab_ {
@@ -750,17 +751,23 @@ struct csmodeutil_ {
/* Server data */
+typedef enum {
+ SSYNC_UNKNOWN = 0, /* We can't get the sync state */
+ SSYNC_IN_PROGRESS = 1, /* Sync is currently in progress */
+ SSYNC_DONE = 2 /* We're in sync */
+} SyncState;
+
struct server_ {
Server *next, *prev;
- char *name; /* Server name */
- uint16 hops; /* Hops between services and server */
- char *desc; /* Server description */
- uint16 flags; /* Some info flags, as defined below */
- char *suid; /* Server Univeral ID */
- int sync; /* Whether is synced or not */
-
- Server *links; /* Linked list head for linked servers */
+ char *name; /* Server name */
+ uint16 hops; /* Hops between services and server */
+ char *desc; /* Server description */
+ uint16 flags; /* Some info flags, as defined below */
+ char *suid; /* Server Univeral ID */
+ SyncState sync; /* Server sync state (see above) */
+
+ Server *links; /* Linked list head for linked servers */
Server *uplink; /* Server which pretends to be the uplink */
};
diff --git a/src/bahamut.c b/src/bahamut.c
index b988ff858..793801343 100644
--- a/src/bahamut.c
+++ b/src/bahamut.c
@@ -112,6 +112,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -1614,9 +1615,9 @@ int anope_event_burst(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
}
return MOD_CONT;
}
diff --git a/src/channels.c b/src/channels.c
index 654e1681a..529073ec2 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1281,7 +1281,7 @@ void chan_adduser2(User * user, Channel * c)
}
/* Added channelname to entrymsg - 30.03.2004, Certus */
/* Also, don't send the entrymsg when bursting -GD */
- if (c->ci && c->ci->entry_message && (me_server->sync == 1))
+ if (c->ci && c->ci->entry_message && is_sync(user->server))
notice_user(whosends(c->ci), user, "[%s] %s", c->name,
c->ci->entry_message);
}
@@ -1302,7 +1302,7 @@ void chan_adduser2(User * user, Channel * c)
* to has synced, or we'll get greet-floods when the net
* recovers from a netsplit. -GD
*/
- if (me_server->sync == 1) {
+ if (is_sync(user->server) == 1) {
anope_cmd_privmsg(c->ci->bi->nick, c->name, "[%s] %s",
user->na->nick, user->na->nc->greet);
c->ci->bi->lastmsg = time(NULL);
diff --git a/src/dreamforge.c b/src/dreamforge.c
index 399f3c765..2165035c2 100644
--- a/src/dreamforge.c
+++ b/src/dreamforge.c
@@ -110,6 +110,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 0, /* reports sync state */
}
,
{NULL}
diff --git a/src/hybrid.c b/src/hybrid.c
index b81874282..2fa6315ca 100644
--- a/src/hybrid.c
+++ b/src/hybrid.c
@@ -110,6 +110,7 @@ IRCDVar ircd[] = {
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -931,9 +932,9 @@ int anope_event_eob(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
return MOD_CONT;
}
diff --git a/src/plexus.c b/src/plexus.c
index 83684f0ac..e15348815 100644
--- a/src/plexus.c
+++ b/src/plexus.c
@@ -110,6 +110,7 @@ IRCDVar ircd[] = {
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -1013,9 +1014,9 @@ int anope_event_eob(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
return MOD_CONT;
}
diff --git a/src/ptlink.c b/src/ptlink.c
index 753ca2db9..a91a1271e 100644
--- a/src/ptlink.c
+++ b/src/ptlink.c
@@ -110,6 +110,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 0, /* reports sync state */
}
,
{NULL}
diff --git a/src/rageircd.c b/src/rageircd.c
index ea7719bb2..c8a4019d6 100644
--- a/src/rageircd.c
+++ b/src/rageircd.c
@@ -111,6 +111,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
},
{NULL}
};
@@ -591,9 +592,9 @@ int anope_event_burst(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
}
return MOD_CONT;
}
diff --git a/src/ratbox.c b/src/ratbox.c
index 38ea060b2..d0b5ef3e8 100644
--- a/src/ratbox.c
+++ b/src/ratbox.c
@@ -112,6 +112,7 @@ IRCDVar ircd[] = {
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 0, /* reports sync state */
}
,
{NULL}
diff --git a/src/servers.c b/src/servers.c
index 211d27fce..e5579bca0 100644
--- a/src/servers.c
+++ b/src/servers.c
@@ -15,7 +15,8 @@
#include "services.h"
Server *servlist = NULL;
-Server *me_server = NULL; /* Our uplink server */
+Server *me_server = NULL; /* This are we */
+Server *serv_uplink = NULL; /* This is our uplink */
uint32 uplink_capab;
char *uplink;
char *TS6UPLINK;
@@ -103,7 +104,10 @@ Server *new_server(Server * uplink, const char *name, const char *desc,
} else {
serv->suid = NULL;
}
- serv->sync = -1;
+ if (ircd->sync)
+ serv->sync = SSYNC_IN_PROGRESS;
+ else
+ serv->sync = SSYNC_UNKNOWN;
serv->links = NULL;
serv->prev = NULL;
@@ -120,6 +124,9 @@ Server *new_server(Server * uplink, const char *name, const char *desc,
uplink->links->prev = serv;
uplink->links = serv;
}
+ /* Check if this is our uplink server */
+ if ((uplink == me_server) && !(flags & SERVER_JUPED))
+ serv_uplink = serv;
return serv;
}
@@ -289,14 +296,13 @@ int anope_check_sync(const char *name)
Server *s;
s = findserver(servlist, name);
- if (!s) {
- return 0;
- }
- if (s->sync) {
- return s->sync;
- } else {
+ if (!s)
return 0;
- }
+
+ if (is_sync(s))
+ return 1;
+ else
+ return -1;
}
/*************************************************************************/
@@ -522,4 +528,19 @@ int is_ulined(char *server)
return 0;
}
+/*************************************************************************/
+
+/**
+ * See if the current server is synced, or has an unknown sync state
+ * (in which case we pretend it is always synced)
+ * @param server Server of which we want to know the state
+ * @return int 0 if not synced, 1 if synced
+ */
+int is_sync(Server * server)
+{
+ if ((server->sync == SSYNC_DONE) || (server->sync == SSYNC_UNKNOWN))
+ return 1;
+ return 0;
+}
+
/* EOF */
diff --git a/src/shadowircd.c b/src/shadowircd.c
index 954ca1c20..e97e25c03 100644
--- a/src/shadowircd.c
+++ b/src/shadowircd.c
@@ -113,6 +113,7 @@ IRCDVar ircd[] = {
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -1145,9 +1146,9 @@ int anope_event_eos(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
return MOD_CONT;
}
diff --git a/src/solidircd.c b/src/solidircd.c
index 92888a1b9..028faf7fc 100644
--- a/src/solidircd.c
+++ b/src/solidircd.c
@@ -112,6 +112,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -1651,9 +1652,9 @@ int anope_event_burst(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
}
return MOD_CONT;
}
diff --git a/src/ultimate2.c b/src/ultimate2.c
index ad72972c7..8c24f29bd 100644
--- a/src/ultimate2.c
+++ b/src/ultimate2.c
@@ -110,6 +110,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 0, /* reports sync state */
}
,
{NULL}
diff --git a/src/ultimate3.c b/src/ultimate3.c
index 75059d339..97fdddb62 100644
--- a/src/ultimate3.c
+++ b/src/ultimate3.c
@@ -112,6 +112,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
},
{NULL}
};
@@ -1744,9 +1745,9 @@ int anope_event_eob(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
}
return MOD_CONT;
}
@@ -1759,9 +1760,14 @@ int anope_event_burst(char *source, int ac, char **av)
if (!ac) {
/* for future use - start burst */
} else {
- if (s) {
- s->sync = 1;
- }
+ /* If we found a server with the given source, that one just
+ * finished bursting. If there was no source, then our uplink
+ * server finished bursting. -GD
+ */
+ if (s)
+ s->sync = SSYNC_DONE;
+ else
+ me_server->sync = SSYNC_DONE;
}
return MOD_CONT;
}
diff --git a/src/unreal31.c b/src/unreal31.c
index cbdc77276..a39c8e4fe 100644
--- a/src/unreal31.c
+++ b/src/unreal31.c
@@ -113,6 +113,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 0, /* reports sync state */
},
{NULL}
};
diff --git a/src/unreal32.c b/src/unreal32.c
index ea2a8e0cc..5699717ca 100644
--- a/src/unreal32.c
+++ b/src/unreal32.c
@@ -112,6 +112,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
},
{NULL}
};
@@ -1572,9 +1573,9 @@ int anope_event_eos(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
return MOD_CONT;
}
diff --git a/src/viagra.c b/src/viagra.c
index 90e99e8c3..772971ea2 100644
--- a/src/viagra.c
+++ b/src/viagra.c
@@ -111,6 +111,7 @@ IRCDVar ircd[] = {
1, /* support helper umode */
0, /* p10 */
NULL, /* character set */
+ 1, /* reports sync state */
}
,
{NULL}
@@ -643,9 +644,9 @@ int anope_event_burst(char *source, int ac, char **av)
* server finished bursting. -GD
*/
if (s)
- s->sync = 1;
- else
- me_server->sync = 1;
+ s->sync = SSYNC_DONE;
+ else if (serv_uplink)
+ serv_uplink->sync = SSYNC_DONE;
}
return MOD_CONT;
}
diff --git a/version.log b/version.log
index da35cdb27..84dc644b4 100644
--- a/version.log
+++ b/version.log
@@ -8,10 +8,14 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="8"
-VERSION_BUILD="618"
+VERSION_BUILD="619"
# $Log$
#
+# BUILD : 1.7.8 (619)
+# BUGS :
+# NOTES : Fixed the recording of server sync state more reliable, which fixes a bug where servers which did not report bursts would always remain in burst-mode internally
+#
# BUILD : 1.7.8 (618)
# BUGS :
# NOTES : Fixed a small error in my previous commit caused by making a few if/else if easier to read