Changeset 813 for branches


Ignore:
Timestamp:
10/01/07 03:22:42 (5 years ago)
Author:
wd
Message:

Update to work around dumb gaim bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/protocols/shared/rfc1459_io.c

    r717 r813  
    9999#ifdef RFC1459_SEND_MSG_LONG 
    100100    if (from->client != NULL) 
    101         sm.len = sprintf(buf, ":%s!%s@%s %s %s%s", from->client->nick, 
    102                 from->client->user, from->client->host, cmd, 
    103                 (to != NULL ? to : ""), (to != NULL ? " " : "")); 
     101        sm.len = sprintf(buf, ":%s!%s@%s %s", from->client->nick, 
     102                from->client->user, from->client->host, cmd); 
    104103#else 
    105104    if (from->client != NULL) 
    106         sm.len = sprintf(buf, ":%s %s %s%s", from->client->nick, cmd, 
    107                 (to != NULL ? to : ""), (to != NULL ? " " : "")); 
     105        sm.len = sprintf(buf, ":%s %s", from->client->nick, cmd); 
    108106#endif 
    109107    else if (from->server != NULL) 
    110         sm.len = sprintf(buf, ":%s %s %s%s", from->server->name, cmd,  
    111                 (to != NULL ? to : ""), (to != NULL ? " " : "")); 
     108        sm.len = sprintf(buf, ":%s %s", from->server->name, cmd); 
    112109    else 
    113         sm.len = sprintf(buf, "%s %s%s", cmd, 
    114                 (to != NULL ? to : ""), (to != NULL ? " " : "")); 
    115     if (msg != NULL) 
     110        sm.len = sprintf(buf, "%s", cmd); 
     111 
     112    /* If to is provided we format the message in a special way to work 
     113     * around some clients incorrect assumptions about the way the server 
     114     * is required to send messages.  Specifially the gaim/pidgin developers 
     115     * refuse to fix a bug in their parser related to handling the JOIN 
     116     * command properly when the last argument is not prefixed with a : (not 
     117     * required). */ 
     118    if (to != NULL) { 
     119        if (msg == NULL) 
     120            sm.len += sprintf(buf + sm.len, " :%s", to); 
     121        else 
     122            sm.len += sprintf(buf + sm.len, " %s ", to); 
     123    } 
     124 
     125    if (msg != NULL) { 
     126        if (to == NULL) 
     127            /* we need an extra space because of the above.. */ 
     128            buf[sm.len++] = ' '; 
     129 
    116130        sm.len += vsnprintf(&buf[sm.len], MAX_PACKET_LEN - 3 - sm.len, msg, 
    117131                args); 
     132    } 
    118133 
    119134    /* XXX: GREAT POTENTIAL FOR EVIL.  Someone running their server in 
Note: See TracChangeset for help on using the changeset viewer.