Changeset 280c56a for irc_user.c


Ignore:
Timestamp:
2010-03-27T17:36:47Z (10 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
74f1cde
Parents:
2f53ada
Message:

Added privmsg handlers to users/channels. root commands are coming back.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_user.c

    r2f53ada r280c56a  
    5151        irc_user_t *iu;
    5252       
    53         if( !( iu = irc_user_find( irc, nick ) ) )
     53        if( !( iu = irc_user_by_name( irc, nick ) ) )
    5454                return 0;
    5555       
     
    6868}
    6969
    70 irc_user_t *irc_user_find( irc_t *irc, const char *nick )
     70irc_user_t *irc_user_by_name( irc_t *irc, const char *nick )
    7171{
    7272        char key[strlen(nick)+1];
     
    8181int irc_user_rename( irc_t *irc, const char *old, const char *new )
    8282{
    83         irc_user_t *iu = irc_user_find( irc, old );
     83        irc_user_t *iu = irc_user_by_name( irc, old );
    8484        char key[strlen(new)+1];
    8585       
    8686        strcpy( key, new );
    87         if( iu == NULL || !nick_lc( key ) || irc_user_find( irc, new ) )
     87        if( iu == NULL || !nick_lc( key ) || irc_user_by_name( irc, new ) )
    8888                return 0;
    8989       
     
    113113        return strcmp( a->key, b->key );
    114114}
     115
     116/* User-type dependent functions, for root/NickServ: */
     117static gboolean root_privmsg( irc_user_t *iu, const char *msg )
     118{
     119        root_command_string( iu->irc, msg );
     120       
     121        return TRUE;
     122}
     123
     124const struct irc_user_funcs irc_user_root_funcs = {
     125        root_privmsg,
     126};
     127
     128/* Echo to yourself: */
     129static gboolean self_privmsg( irc_user_t *iu, const char *msg )
     130{
     131        irc_send_msg( iu, "PRIVMSG", iu->nick, msg );
     132       
     133        return TRUE;
     134}
     135
     136const struct irc_user_funcs irc_user_self_funcs = {
     137        self_privmsg,
     138};
Note: See TracChangeset for help on using the changeset viewer.