Changeset 833


Ignore:
Timestamp:
05/11/09 01:24:59 (3 years ago)
Author:
wd
Message:

Add a new NPC command. Add sendto_channel_remote function.

Location:
branches/ithildin-1.1/modules/ircd
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/send.c

    r823 r833  
    329329        if (conn == NULL) 
    330330            continue; 
     331 
     332        if (conn->proto->tmpmsg == NULL) 
     333            sm = conn->proto->output(&ps, cmd, chan->name, msg, vl); 
     334        if (CACHE_MSG(conn->proto)) { 
     335            conn->proto->tmpmsg = create_sendq_block(sm->msg, sm->len); 
     336            sendq_push(conn->proto->tmpmsg, conn); 
     337        } else 
     338            sendq_push(create_sendq_block(sm->msg, sm->len), conn); 
     339    } 
     340 
     341    CLEAR_SEND_TEMPS(); 
     342    va_end(vl); 
     343} 
     344 
     345/* sends a message to every server which has users in the channel except the 
     346 * server sending the message */ 
     347void sendto_channel_remote(channel_t *chan, client_t *cli, server_t *srv, 
     348        char *cmd, char *msg, ...) { 
     349    struct protocol_sender ps = {cli, srv}; 
     350    struct send_msg *sm = NULL; 
     351    struct chanlink *cp; 
     352    connection_t *conn; 
     353    va_list vl; 
     354    va_start(vl, msg); 
     355         
     356    /* walk the channel list, only send to our own clients. */ 
     357    LIST_FOREACH(cp, &chan->users, lpchan) { 
     358        if (MYCLIENT(cp->cli)) 
     359            continue; 
     360 
     361        conn = cli_uplink(cp->cli); 
     362        if (conn == NULL) 
     363            continue; /* skip this one */ 
     364        if (ircd.sends[conn->sock->fd]) 
     365            continue; 
     366        else 
     367            ircd.sends[conn->sock->fd] = 1; 
    331368 
    332369        if (conn->proto->tmpmsg == NULL) 
  • branches/ithildin-1.1/modules/ircd/send.h

    r727 r833  
    7070void sendto_channel_local(channel_t *, client_t *, server_t *, char *, char *, 
    7171               ...) __PRINTF0(5); 
     72void sendto_channel_remote(channel_t *, client_t *, server_t *, char *, char *, 
     73               ...) __PRINTF0(5); 
    7274void sendto_channel_butone(channel_t *, client_t *, client_t *, server_t *, 
    7375        char *, char *, ...) __PRINTF0(6); 
Note: See TracChangeset for help on using the changeset viewer.