taskWeeChat - Tasks: task #6583, handle netsplits in some better...


task #6583: handle netsplits in some better way.

Submitted by:  None
Submitted on:  Sun 04 Mar 2007 05:10:12 PM UTC  
Votes:  108  
Category:  irc plugin Should Start On:  Sun 04 Mar 2007 12:00:00 AM UTC
Should be Finished on:  Fri 01 Jan 2038 12:00:00 AM UTC Priority:  1 - Later
Status:  None Privacy:  Public
Percent Complete:  0% Assigned to:  None
Originator Name:  darkk Originator Email:  -email is unavailable-
Open/Closed:  Open Planned Release:  None
IRC nick: 

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 24 Jan 2014 03:54:27 PM UTC, comment #2:

This is how irssi detects netsplit quits.

(Some checks might no longer be necessary, as almost all servers prefix user-provided quit messages with "Quit: " or similar. Still...)

/* check if quit message is a netsplit message */
int quitmsg_is_split(const char *msg)
const char *host2, *p;
int prev, len, host1_dot, host2_dot;

g_return_val_if_fail(msg != NULL, FALSE);

/* NOTE: there used to be some paranoia checks (some older IRC
clients have even more), but they're pretty useless nowadays,
since IRC server prefixes the quit message with a space if it
looks like a netsplit message.

So, the check is currently just:
- host1.domain1 host2.domain2
- top-level domains have to be 2+ characters long,
containing only alphabets
- only 1 space
- no double-dots (".." - probably useless check)
- hosts/domains can't start or end with a dot
- the two hosts can't be identical (probably useless check)
- can't contain ':' or '/' chars (some servers allow URLs)
host2 = NULL;
prev = '\0'; len = 0; host1_dot = host2_dot = 0;
while (*msg != '\0') {
if (*msg == ' ') {
if (prev == '.' || prev == '\0') {
/* domains can't end with '.', space can't
be the first character in msg. */
return FALSE;
if (host2 != NULL)
return FALSE; /* only one space allowed */
if (!host1_dot)
return FALSE; /* host1 didn't have domain */
host2 = msg+1; len = -1;
} else if (*msg == '.') {
if (prev == '\0' || prev == ' ' || prev == '.') {
/* domains can't start with '.'
and can't have ".." */
return FALSE;

if (host2 != NULL)
host2_dot = TRUE;
host1_dot = TRUE;
} else if (*msg == ':' || *msg == '/')
return FALSE;

prev = *msg;
msg++; len++;

if (!host2_dot || prev == '.')
return FALSE;

/* top-domain1 must be 2+ chars long and contain only alphabets */
p = host2-1;
while (p[-1] != '.') {
if (!i_isalpha(p[-1]))
return FALSE;
if (host2-p-1 < 2) return FALSE;

/* top-domain2 must be 2+ chars long and contain only alphabets */
p = host2+strlen(host2);
while (p[-1] != '.') {
if (!i_isalpha(p[-1]))
return FALSE;
if (strlen(p) < 2) return FALSE;

return TRUE;

Mantas Mikul─Śnas <grawity>
Tue 30 Sep 2008 03:20:32 PM UTC, comment #1:

+1 to this. It would be nicer to get nicks grouped in a single message, with a command to show more, than 100 separate messages.

tigrmesh <tigrmesh>
Sun 04 Mar 2007 05:10:12 PM UTC, original submission:

Will be nice if we see something better than 100 lines of nicks with same quit message, something like
<-- netsplit (irc.foo.bar irc.42.baz): Nick, Name, Nickname
--> netsplit over.... (nicklist)

quote from rfc2813

When "netsplit" (See Section 4.1.6) occur, the "Quit Message" is
composed of the names of two servers involved, separated by a space.
The first name is that of the server which is still connected and the
second name is either that of the server which has become
disconnected or that of the server to which the leaving client was

<Quit Message> = ":" servername SPACE servername

Because the "Quit Message" has a special meaning for "netsplits",
servers SHOULD NOT allow a client to use a <Quit Message> in the
format described above.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by grawity (Posted a comment)
  • -email is unavailable- added by arza (Voted in favor of this item)
  • -email is unavailable- added by flashcode (Updated the item)
  • -email is unavailable- added by tigrmesh (Posted a comment)
  • -email is unavailable- added by yannickp (Voted in favor of this item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 108 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-07 arza Carbon-Copy- => Added arza
    2009-01-11 flashcode CategoryNone => irc plugin
    2007-11-15 yannickp Carbon-Copy- => Added yannickp

    Back to the top

    Powered by Savane 3.4