Changeset 256899f for root_commands.c


Ignore:
Timestamp:
2007-11-19T23:16:18Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
7df5a08
Parents:
cd428e4 (diff), ef5c185 (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:

Merging Jabber groupchat support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    rcd428e4 r256899f  
    930930        if( cmd[3] )
    931931        {
    932                 channel = g_strdup( cmd[3] );
     932                if( cmd[3][0] != '#' && cmd[3][0] != '&' )
     933                        channel = g_strdup_printf( "&%s", cmd[3] );
     934                else
     935                        channel = g_strdup( cmd[3] );
    933936        }
    934937        else
     
    936939                char *s;
    937940               
    938                 channel = g_strdup( chat );
     941                channel = g_strdup_printf( "&%s", chat );
    939942                if( ( s = strchr( channel, '@' ) ) )
    940943                        *s = 0;
     
    942945        if( cmd[3] && cmd[4] )
    943946                nick = cmd[4];
     947        else
     948                nick = irc->nick;
    944949        if( cmd[3] && cmd[4] && cmd[5] )
    945950                password = cmd[5];
    946951       
    947         c = a->prpl->chat_join( ic, chat, nick, password );
    948        
    949         g_free( channel );
     952        if( !nick_ok( channel + 1 ) )
     953        {
     954                irc_usermsg( irc, "Invalid channel name: %s", channel );
     955                g_free( channel );
     956                return;
     957        }
     958        else if( g_strcasecmp( channel, irc->channel ) == 0 || irc_chat_by_channel( irc, channel ) )
     959        {
     960                irc_usermsg( irc, "Channel already exists: %s", channel );
     961                g_free( channel );
     962                return;
     963        }
     964       
     965        if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) )
     966        {
     967                g_free( c->channel );
     968                c->channel = channel;
     969        }
     970        else
     971        {
     972                irc_usermsg( irc, "Tried to join chat, not sure if this was successful" );
     973                g_free( channel );
     974        }
    950975}
    951976
Note: See TracChangeset for help on using the changeset viewer.