Пример #1
0
void irc_send_login(irc_t *irc)
{
	irc_send_num(irc,   1, ":Welcome to the %s gateway, %s", PACKAGE, irc->user->nick);
	irc_send_num(irc,   2, ":Host %s is running %s %s %s/%s.", irc->root->host,
	             PACKAGE, BITLBEE_VERSION, ARCH, CPU);
	irc_send_num(irc,   3, ":%s", IRCD_INFO);
	irc_send_num(irc,   4, "%s %s %s %s", irc->root->host, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES);
	irc_send_num(irc,   5, "PREFIX=(ohv)@%%+ CHANTYPES=%s CHANMODES=,,,%s NICKLEN=%d CHANNELLEN=%d "
	             "NETWORK=BitlBee SAFELIST CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 "
	             "FLOOD=0/9999 :are supported by this server",
	             CTYPES, CMODES, MAX_NICK_LENGTH - 1, MAX_NICK_LENGTH - 1);
	irc_send_motd(irc);
}
Пример #2
0
extern int handle_irc_welcome(t_connection * conn)
{
    char temp[MAX_IRC_MESSAGE_LEN];
    std::time_t temptime;
    char const * tempname;
    char const * temptimestr;

    if (!conn) {
        eventlog(eventlog_level_error,__FUNCTION__,"got NULL connection");
        return -1;
    }

    tempname = conn_get_loggeduser(conn);

    if ((34+std::strlen(tempname)+1)<=MAX_IRC_MESSAGE_LEN)
        std::sprintf(temp,":Welcome to the %s IRC Network %s",prefs_get_irc_network_name(), tempname);
    else
        std::sprintf(temp,":Maximum length exceeded");
    irc_send(conn,RPL_WELCOME,temp);

    if ((14+std::strlen(server_get_hostname())+10+std::strlen(PVPGN_SOFTWARE" "PVPGN_VERSION)+1)<=MAX_IRC_MESSAGE_LEN)
        std::sprintf(temp,":Your host is %s, running "PVPGN_SOFTWARE" "PVPGN_VERSION,server_get_hostname());
    else
        std::sprintf(temp,":Maximum length exceeded");
    irc_send(conn,RPL_YOURHOST,temp);

    temptime = server_get_starttime(); /* FIXME: This should be build time */
    temptimestr = std::ctime(&temptime);
    if ((25+std::strlen(temptimestr)+1)<=MAX_IRC_MESSAGE_LEN)
        std::sprintf(temp,":This server was created %s",temptimestr); /* FIXME: is ctime() portable? */
    else
        std::sprintf(temp,":Maximum length exceeded");
    irc_send(conn,RPL_CREATED,temp);

    /* we don't give mode information on MYINFO we give it on ISUPPORT */
    if ((std::strlen(server_get_hostname())+7+std::strlen(PVPGN_SOFTWARE" "PVPGN_VERSION)+9+1)<=MAX_IRC_MESSAGE_LEN)
        std::sprintf(temp,"%s "PVPGN_SOFTWARE" "PVPGN_VERSION" - -",server_get_hostname());
    else
        std::sprintf(temp,":Maximum length exceeded");
    irc_send(conn,RPL_MYINFO,temp);

    std::sprintf(temp,"NICKLEN=%d TOPICLEN=%d CHANNELLEN=%d PREFIX=%s CHANTYPES="CHANNEL_TYPE" NETWORK=%s IRCD="PVPGN_SOFTWARE,
                 MAX_CHARNAME_LEN, MAX_TOPIC_LEN, MAX_CHANNELNAME_LEN, CHANNEL_PREFIX, prefs_get_irc_network_name());

    if((std::strlen(temp))<=MAX_IRC_MESSAGE_LEN)
        irc_send(conn,RPL_ISUPPORT,temp);
    else {
        std::sprintf(temp,":Maximum length exceeded");
        irc_send(conn,RPL_ISUPPORT,temp);
    }

    irc_send_motd(conn);

    message_send_text(conn,message_type_notice,NULL,"This is an experimental service");

    conn_set_state(conn,conn_state_bot_password);

    if (conn_get_ircpass(conn)) {
        message_send_text(conn,message_type_notice,NULL,"Trying to authenticate with PASS ...");
        irc_authenticate(conn,conn_get_ircpass(conn));
    } else {
        message_send_text(conn,message_type_notice,NULL,"No PASS command received. Please identify yourself by /msg NICKSERV identify <password>.");
    }
    return 0;
}
Пример #3
0
static void irc_cmd_motd( irc_t *irc, char **cmd )
{
	irc_send_motd( irc );
}