* generate ExitClient from the main loop.
*
* If 'notice' is not NULL, it is assumed to be a format
- * for a message to local opers. I can contain only one
+ * for a message to local opers. It can contain only one
* '%s', which will be replaced by the sockhost field of
* the failing link.
*
DBufClear(&to->recvQ);
DBufClear(&to->sendQ);
- /* Keep a copy of the last comment, for later use... */
- ircd_strncpy(LastDeadComment(to), notice, sizeof(LastDeadComment(to) - 1));
- LastDeadComment(to)[sizeof(LastDeadComment(to)) - 1] = '\0';
+ /*
+ * Keep a copy of the last comment, for later use...
+ */
+ ircd_strncpy(to->info, notice, REALLEN);
if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
- sendto_ops("%s for %s", LastDeadComment(to), to->name);
- Debug((DEBUG_ERROR, LastDeadComment(to)));
+ sendto_ops("%s for %s", to->info, to->name);
+ Debug((DEBUG_ERROR, to->info));
}
static int can_send(struct Client* to)
break;
}
else {
- if (IsDead(to))
- dead_link(to, "Write error, closing link");
+ if (IsDead(to)) {
+ char tmp[512];
+ sprintf(tmp,"Write error: %s",(strerror(to->error)) ? (strerror(to->error)) : "Unknown error" );
+ dead_link(to, tmp);
+ }
break;
}
}
int i;
int flag=-1;
+ assert(0 != cmd);
/*
* Precalculate the buffers we sent to the clients instead of doing an
* expensive sprintf() per member that we send to. We still have to
*/
if (IsServer(from)) {
sprintf(userbuf,":%s %s %s :%s",
- from->name,
- ((cmd[0] == 'P') ? MSG_PRIVATE : MSG_NOTICE),
- chname, msg);
- sprintf(servbuf,"%s " TOK_PRIVATE " %s :%s",
- NumServ(from), chname, msg);
- } else {
+ from->name, ('P' == *cmd) ? MSG_PRIVATE : MSG_NOTICE, chname, msg);
+ sprintf(servbuf,"%s %s %s :%s", NumServ(from), cmd, chname, msg);
+ }
+ else {
sprintf(userbuf,":%s!%s@%s %s %s :%s",
- from->name, from->username, from->user->host,
- ((cmd[0] == 'P') ? MSG_PRIVATE : MSG_NOTICE),
- chname, msg);
- sprintf(servbuf,"%s%s %s %s :%s",
- NumNick(from),
- ((cmd[0] == 'P') ? TOK_PRIVATE : TOK_NOTICE),
- chname, msg);
+ from->name, from->username, from->user->host,
+ ('P' == *cmd) ? MSG_PRIVATE : MSG_NOTICE, chname, msg);
+ sprintf(servbuf,"%s%s %s %s :%s", NumNick(from), cmd, chname, msg);
}
++sentalong_marker;
}
/*
- * sendto_server_butone
+ * sendto_serv_butone
*
* Send a message to all connected servers except the client 'one'.
*/