示例#1
0
static void on_nick( irc_session_t *session,
                 const char *event,
                 const char *origin,
                 const char **params,
                 unsigned int count) {

    printf("%s changed to %s\n", origin, params[0]);
    irc_cmd_names(session, bot_channel);
}
示例#2
0
static void* refresh_names(void* session) {

    /* Loop forever */
    while (!bot_exiting) {
        irc_cmd_names((irc_session_t*)session, bot_channel);
        sleep(5 * 60);
    }

    return NULL;
}
示例#3
0
static void on_event(   irc_session_t *session,
                        unsigned int event,
                        const char *origin,
                        const char **params,
                        unsigned int count) {
    
    unsigned int init_count;
    unsigned int i;

    char buf[256] = "";
    char* tok;

    switch (event) {
    case LIBIRC_RFC_RPL_NAMREPLY:
        if (name_listing == false) {
            name_listing = true;
            name_count = 0;
/*            printf("Channel listing for %s\n", bot_channel);*/
        }
        
        init_count = name_count;

        i = 0;
        strcpy(buf, params[3]);
       
        tok = strtok(buf, " ");
        if (tok != NULL) {         
            do {
                strcpy(name_list[i], tok);
/*                printf("%s\n", name_list[i]);*/
                i++;

            } while((tok = strtok(NULL, " ")));
        }

        name_count += i;
        
        break;

    case LIBIRC_RFC_RPL_ENDOFNAMES:
        name_listing = false;
        break;

    case LIBIRC_RFC_RPL_UMODEIS:
        printf("Mode has changed...\n");
        irc_cmd_names(session, bot_channel);
        break;
    }

/*    printf("Event: %d \n", event); */
}
示例#4
0
void IRC::requestIrcParticipant(std::string& lobbyName)
{
    std::cout << "IRC::requestIrcParticipant() lobby: " << lobbyName << std::endl;

    // participant list was requested -> remove lock
    if(_suppressParticipant)
        _suppressParticipant = false;

    // clear participants list
    _ircParticipantList.pList.clear();

    // search server/channel
    irc_session_t* session = NULL;
    ConfigHandler::IRCOptions_Server s;
    ConfigHandler::IRCOptions_Bridge b;
    bool found = rsLobbyNameToIrc(lobbyName, session, s, b);

    if(found)
        irc_cmd_names (session, b.ircChannelName.c_str());
    else
        std::cerr << "IRC::requestIrcParticipant() unable to find a fitting IRC channel (rs lobby: " << lobbyName << ")" << std::endl;
}
示例#5
0
static void on_join( irc_session_t *session,
                 const char *event,
                 const char *origin,
                 const char **params,
                 unsigned int count) {

    pthread_t refresh_th;
   
    char nick[256];
    irc_target_get_nick(origin, nick, 256);

    printf("%s Joined %s\n", nick, params[0]);
    irc_cmd_names(session, params[0]);
   
    if (strcmp(params[0], bot_channel) == 0) { 
        pthread_create(&refresh_th, NULL, refresh_names, (void*)session);
    } 
    
    if (greeter_on && strcmp(bot_nick, nick) != 0) {
        printf("Greeting %s\n", nick);
        botcmd_greet(session, nick, bot_channel);
    }
}
void ChatNetworkingIRC::requestMemberList( const std::string& channel )
{
    _nickNames.clear();
    irc_cmd_names( _p_session, channel.c_str() );
}
示例#7
0
void dazeus::Server::names( const std::string &channel ) {
	irc_cmd_names(IRC, channel.c_str());
}
示例#8
0
void IRCSession::names(string_t channel) {
  if (irc_cmd_names( session, channel))
    throw std::runtime_error{"Could not get names."};
}