diff options
author | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-02 06:06:47 +0000 |
---|---|---|
committer | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-02 06:06:47 +0000 |
commit | f18d506cad80b9ed28f02ee33f35332320f3ea04 (patch) | |
tree | 2d9d0cd5a48e4677dfefa114aca17e3f28926a79 /src/servers.c | |
parent | 541f11e4b80cbb2cc76da34fb2e1659b5e8b0090 (diff) |
BUILD : 1.7.6 (468) BUGS : N/A NOTES : 1. fixes del_session() warning when LimitSessions is disabled 2. actions.c is doxygen ready, along with code clean up 3. sessions.c cleaned up and moved some items around 4. ChanServ AKICK (pointed to freed memory) 5. servers.c is doxygen ready, along with some code clean up
git-svn-id: svn://svn.anope.org/anope/trunk@468 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@322 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/servers.c')
-rw-r--r-- | src/servers.c | 96 |
1 files changed, 73 insertions, 23 deletions
diff --git a/src/servers.c b/src/servers.c index 303f25d87..4cd04e8eb 100644 --- a/src/servers.c +++ b/src/servers.c @@ -23,7 +23,11 @@ static Server *server_cur; /*************************************************************************/ -/* Walk through the servers list */ +/** + * Return the first server in the server struct + * @param flags Server Flags, see services.h + * @return Server Struct + */ Server *first_server(int flags) { server_cur = servlist; @@ -34,6 +38,13 @@ Server *first_server(int flags) return server_cur; } +/*************************************************************************/ + +/** + * Return the next server in the server struct + * @param flags Server Flags, see services.h + * @return Server Struct + */ Server *next_server(int flags) { if (!server_cur) @@ -60,12 +71,18 @@ Server *next_server(int flags) /*************************************************************************/ -/* This function makes a new Server structure and links it in the right +/** + * This function makes a new Server structure and links it in the right * places in the linked list if a Server struct to it's uplink if provided. * It can also be NULL to indicate it's the uplink and should be first in * the server list. + * @param uplink Server struct + * @param name Server Name + * @param desc Server Description + * @param flags Server Flags, see services.h + * @param suid Server Universal ID + * @return Server Struct */ - Server *new_server(Server * uplink, const char *name, const char *desc, uint16 flags, char *suid) { @@ -102,13 +119,16 @@ Server *new_server(Server * uplink, const char *name, const char *desc, /*************************************************************************/ -/* Remove and free a Server structure. This function is the most complete +/** + * Remove and free a Server structure. This function is the most complete * remove treatment a server can get, as it first quits all clients which * still pretend to be on this server, then it walks through all connected * servers and disconnects them too. If all mess is cleared, the server * itself will be too. + * @param Server struct + * @param reason the server quit + * @return void */ - static void delete_server(Server * serv, const char *quitreason) { Server *s, *snext; @@ -140,8 +160,9 @@ static void delete_server(Server * serv, const char *quitreason) (quitreason ? sstrdup(quitreason) : NULL); } #ifndef STREAMLINED - if (LimitSessions) + if (LimitSessions) { del_session(u->host); + } #endif delete_user(u); } @@ -177,8 +198,12 @@ static void delete_server(Server * serv, const char *quitreason) /*************************************************************************/ -/* Find a server by name, returns NULL if not found */ - +/** + * Find a server by name, returns NULL if not found + * @param s Server struct + * @param name Server Name + * @return Server struct + */ Server *findserver(Server * s, const char *name) { Server *sl; @@ -187,30 +212,35 @@ Server *findserver(Server * s, const char *name) return NULL; } - if (debug >= 3) + if (debug >= 3) { alog("debug: findserver(%p)", name); + } while (s && (stricmp(s->name, name) != 0)) { if (s->links) { sl = findserver(s->links, name); - if (sl) + if (sl) { s = sl; - else + } else { s = s->next; + } } else { s = s->next; } } - if (debug >= 3) + if (debug >= 3) { alog("debug: findserver(%s) -> %p", name, (void *) s); + } return s; } -/* - Not Synced = -1 - Error = 0 - Synced = 1 -*/ +/*************************************************************************/ +/** + * Find if the server is synced with the network + * @param s Server struct + * @param name Server Name + * @return Not Synced returns -1, Synced returns 1, Error returns 0 + */ int anope_check_sync(const char *name) { Server *s; @@ -227,7 +257,15 @@ int anope_check_sync(const char *name) } /*************************************************************************/ -/* :<introducing server> SERVER <servername> <hops> :<description> + +/** + * Handle adding the server to the Server struct + * @param source Name of the uplink if any + * @param servername Name of the server being linked + * @param hops Number of hops to reach this server + * @param descript Description of the server + * @param numeric Server Numberic/SUID + * @return void */ void do_server(const char *source, char *servername, char *hops, char *descript, char *numeric) @@ -252,7 +290,13 @@ void do_server(const char *source, char *servername, char *hops, } /*************************************************************************/ -/* SQUIT <server> :<comment> + +/** + * Handle removing the server from the Server struct + * @param source Name of the server leaving + * @param ac Number of arguments in av + * @param av Agruments as part of the SQUIT + * @return void */ void do_squit(const char *source, int ac, char **av) { @@ -271,8 +315,9 @@ void do_squit(const char *source, int ac, char **av) if (ircdcap->unconnect) { if ((s->uplink == me_server) && (uplink_capab & ircdcap->unconnect)) { - if (debug) + if (debug) { alog("debug: Sending UNCONNECT SQUIT for %s", s->name); + } /* need to fix */ anope_cmd_squit(s->name, buf); } @@ -281,6 +326,14 @@ void do_squit(const char *source, int ac, char **av) delete_server(s, buf); } +/*************************************************************************/ + +/** + * Handle parsing the CAPAB/PROTOCTL messages + * @param ac Number of arguments in av + * @param av Agruments + * @return void + */ void capab_parse(int ac, char **av) { int i; @@ -371,12 +424,9 @@ void capab_parse(int ac, char **av) if (!stricmp(s, "SSJ3")) { uplink_capab |= CAPAB_SSJ3; } - if (!stricmp(s, "SJB64")) { uplink_capab |= CAPAB_SJB64; - } - if (!stricmp(s, "CHANMODES")) { uplink_capab |= CAPAB_CHANMODE; if (tmp) { |