Changeset 537d9b9 for irc_send.c


Ignore:
Timestamp:
2016-11-20T08:40:36Z (8 years ago)
Author:
dequis <dx@…>
Children:
3f44e43
Parents:
ba52ac5 (diff), 9f03c47 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge master up to commit '9f03c47' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_send.c

    rba52ac5 r537d9b9  
    4141{
    4242        irc_send_num(irc,   1, ":Welcome to the %s gateway, %s", PACKAGE, irc->user->nick);
    43         irc_send_num(irc,   2, ":Host %s is running %s %s %s/%s.", irc->root->host,
    44                      PACKAGE, BITLBEE_VERSION, ARCH, CPU);
     43        irc_send_num(irc,   2, ":Host %s is running %s %s.", irc->root->host,
     44                     PACKAGE, BITLBEE_VERSION);
    4545        irc_send_num(irc,   3, ":%s", IRCD_INFO);
    4646        irc_send_num(irc,   4, "%s %s %s %s", irc->root->host, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES);
     
    5454void irc_send_motd(irc_t *irc)
    5555{
    56         char motd[2048];
    57         ssize_t len;
    58         int fd;
    59 
    60         fd = open(global.conf->motdfile, O_RDONLY);
    61         if (fd == -1 || (len = read(fd, motd, sizeof(motd) - 1)) <= 0) {
     56        char *motd;
     57        size_t len;
     58
     59        g_file_get_contents(global.conf->motdfile, &motd, &len, NULL);
     60
     61        if (!motd || !len) {
    6262                irc_send_num(irc, 422, ":We don't need MOTDs.");
    6363        } else {
     
    6666
    6767                in = motd;
    68                 motd[len] = '\0';
    6968                linebuf[79] = len = 0;
    7069                max = sizeof(linebuf) - 1;
     
    101100        }
    102101
    103         if (fd != -1) {
    104                 close(fd);
    105         }
     102        g_free(motd);
     103
    106104}
    107105
     
    348346                }
    349347
    350                 /* rfc1459 doesn't mention this: G means gone, H means here */
    351                 status_prefix[0] = iu->flags & IRC_USER_AWAY ? 'G' : 'H';
     348                /* If this is the account nick, check configuration to see if away */
     349                if (iu == irc->user) {
     350                        /* rfc1459 doesn't mention this: G means gone, H means here */
     351                        status_prefix[0] = set_getstr(&irc->b->set, "away") ? 'G' : 'H';
     352                } else {
     353                        status_prefix[0] = iu->flags & IRC_USER_AWAY ? 'G' : 'H';
     354                }
    352355
    353356                irc_send_num(irc, 352, "%s %s %s %s %s %s :0 %s",
Note: See TracChangeset for help on using the changeset viewer.