Changes in root_commands.c [b75acf6:0baed0d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
rb75acf6 r0baed0d 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 04Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 143 143 storage_status_t status = storage_load( irc, cmd[1] ); 144 144 char *account_on[] = { "account", "on", NULL }; 145 146 if( strchr( irc->umode, 'R' ) != NULL ) 147 { 148 irc_usermsg( irc, "You're already logged in." ); 149 return; 150 } 145 151 146 152 switch (status) { … … 648 654 irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); 649 655 } 656 else if( g_strcasecmp( cmd[1], irc->channel ) == 0 ) 657 { 658 if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) ) 659 { 660 u = user_find( irc, irc->nick ); 661 662 irc_part( irc, u, irc->channel ); 663 g_free( irc->channel ); 664 irc->channel = g_strdup( cmd[2] ); 665 irc_join( irc, u, irc->channel ); 666 667 if( strcmp( cmd[0], "set_rename" ) != 0 ) 668 set_setstr( &irc->set, "control_channel", cmd[2] ); 669 } 670 } 650 671 else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) ) 651 672 { … … 695 716 696 717 return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID; 718 } 719 720 char *set_eval_control_channel( set_t *set, char *new_name ) 721 { 722 irc_t *irc = set->data; 723 724 if( strcmp( irc->channel, new_name ) != 0 ) 725 { 726 char *cmd[] = { "set_rename", irc->channel, new_name, NULL }; 727 728 cmd_rename( irc, cmd ); 729 } 730 731 return strcmp( irc->channel, new_name ) == 0 ? new_name : SET_INVALID; 697 732 } 698 733 … … 908 943 online = 1; 909 944 else 910 online = 945 online = away = 1; 911 946 912 947 if( strchr( irc->umode, 'b' ) != NULL ) … … 921 956 if( online == 1 ) 922 957 { 958 char st[256] = "Online"; 959 960 if( u->status_msg ) 961 g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg ); 962 923 963 g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user ); 924 irc_usermsg( irc, format, u->nick, s, "Online");964 irc_usermsg( irc, format, u->nick, s, st ); 925 965 } 926 966 … … 1115 1155 irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); 1116 1156 } 1117 1118 1119 1120 #if 01121 account_t *a;1122 struct im_connection *ic;1123 char *chat, *channel, *nick = NULL, *password = NULL;1124 struct groupchat *c;1125 1126 if( !( a = account_get( irc, cmd[1] ) ) )1127 {1128 irc_usermsg( irc, "Invalid account" );1129 return;1130 }1131 else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )1132 {1133 irc_usermsg( irc, "That account is not on-line" );1134 return;1135 }1136 else if( a->prpl->chat_join == NULL )1137 {1138 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );1139 return;1140 }1141 ic = a->ic;1142 1143 chat = cmd[2];1144 if( cmd[3] )1145 {1146 if( strchr( CTYPES, cmd[3][0] ) == NULL )1147 channel = g_strdup_printf( "&%s", cmd[3] );1148 else1149 channel = g_strdup( cmd[3] );1150 }1151 else1152 {1153 char *s;1154 1155 channel = g_strdup_printf( "&%s", chat );1156 if( ( s = strchr( channel, '@' ) ) )1157 *s = 0;1158 }1159 if( cmd[3] && cmd[4] )1160 nick = cmd[4];1161 else1162 nick = irc->nick;1163 if( cmd[3] && cmd[4] && cmd[5] )1164 password = cmd[5];1165 1166 if( !nick_ok( channel + 1 ) )1167 {1168 irc_usermsg( irc, "Invalid channel name: %s", channel );1169 g_free( channel );1170 return;1171 }1172 else if( g_strcasecmp( channel, irc->channel ) == 0 || irc_chat_by_channel( irc, channel ) )1173 {1174 irc_usermsg( irc, "Channel already exists: %s", channel );1175 g_free( channel );1176 return;1177 }1178 1179 if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) )1180 {1181 g_free( c->channel );1182 c->channel = channel;1183 }1184 else1185 {1186 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" );1187 g_free( channel );1188 }1189 #endif1190 1157 } 1191 1158
Note: See TracChangeset
for help on using the changeset viewer.