Changeset 5f8ab6a9 for root_commands.c


Ignore:
Timestamp:
2010-06-03T10:41:03Z (14 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
814aa52
Parents:
3f81999 (diff), f9928cb (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 in bitlbee 1.2.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r3f81999 r5f8ab6a9  
    3030#include "help.h"
    3131#include "otr.h"
     32#include "chat.h"
    3233
    3334#include <string.h>
     
    143144        storage_status_t status = storage_load( irc, cmd[1] );
    144145        char *account_on[] = { "account", "on", NULL };
     146       
     147        if( strchr( irc->umode, 'R' ) != NULL )
     148        {
     149                irc_usermsg( irc, "You're already logged in." );
     150                return;
     151        }
    145152       
    146153        switch (status) {
     
    912919                online = 1;
    913920        else
    914                 online =  away = 1;
     921                online = away = 1;
    915922       
    916923        if( strchr( irc->umode, 'b' ) != NULL )
     
    925932                if( online == 1 )
    926933                {
     934                        char st[256] = "Online";
     935                       
     936                        if( u->status_msg )
     937                                g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg );
     938                       
    927939                        g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user );
    928                         irc_usermsg( irc, format, u->nick, s, "Online" );
     940                        irc_usermsg( irc, format, u->nick, s, st );
    929941                }
    930942               
     
    11191131                irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
    11201132        }
    1121 
    1122 
    1123 
    1124 #if 0
    1125         account_t *a;
    1126         struct im_connection *ic;
    1127         char *chat, *channel, *nick = NULL, *password = NULL;
    1128         struct groupchat *c;
    1129        
    1130         if( !( a = account_get( irc, cmd[1] ) ) )
    1131         {
    1132                 irc_usermsg( irc, "Invalid account" );
    1133                 return;
    1134         }
    1135         else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    1136         {
    1137                 irc_usermsg( irc, "That account is not on-line" );
    1138                 return;
    1139         }
    1140         else if( a->prpl->chat_join == NULL )
    1141         {
    1142                 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
    1143                 return;
    1144         }
    1145         ic = a->ic;
    1146        
    1147         chat = cmd[2];
    1148         if( cmd[3] )
    1149         {
    1150                 if( strchr( CTYPES, cmd[3][0] ) == NULL )
    1151                         channel = g_strdup_printf( "&%s", cmd[3] );
    1152                 else
    1153                         channel = g_strdup( cmd[3] );
    1154         }
    1155         else
    1156         {
    1157                 char *s;
    1158                
    1159                 channel = g_strdup_printf( "&%s", chat );
    1160                 if( ( s = strchr( channel, '@' ) ) )
    1161                         *s = 0;
    1162         }
    1163         if( cmd[3] && cmd[4] )
    1164                 nick = cmd[4];
    1165         else
    1166                 nick = irc->nick;
    1167         if( cmd[3] && cmd[4] && cmd[5] )
    1168                 password = cmd[5];
    1169        
    1170         if( !nick_ok( channel + 1 ) )
    1171         {
    1172                 irc_usermsg( irc, "Invalid channel name: %s", channel );
    1173                 g_free( channel );
    1174                 return;
    1175         }
    1176         else if( g_strcasecmp( channel, irc->channel ) == 0 || irc_chat_by_channel( irc, channel ) )
    1177         {
    1178                 irc_usermsg( irc, "Channel already exists: %s", channel );
    1179                 g_free( channel );
    1180                 return;
    1181         }
    1182        
    1183         if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) )
    1184         {
    1185                 g_free( c->channel );
    1186                 c->channel = channel;
    1187         }
    1188         else
    1189         {
    1190                 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" );
    1191                 g_free( channel );
    1192         }
    1193 #endif
    11941133}
    11951134
Note: See TracChangeset for help on using the changeset viewer.