Changes in root_commands.c [0baed0d:b75acf6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
r0baed0d rb75acf6 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 10Wilmer van der Gaast and others *4 * Copyright 2002-2004 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 }151 145 152 146 switch (status) { … … 654 648 irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); 655 649 } 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 }671 650 else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) ) 672 651 { … … 716 695 717 696 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;732 697 } 733 698 … … 943 908 online = 1; 944 909 else 945 online = away = 1;910 online = away = 1; 946 911 947 912 if( strchr( irc->umode, 'b' ) != NULL ) … … 956 921 if( online == 1 ) 957 922 { 958 char st[256] = "Online";959 960 if( u->status_msg )961 g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg );962 963 923 g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user ); 964 irc_usermsg( irc, format, u->nick, s, st);924 irc_usermsg( irc, format, u->nick, s, "Online" ); 965 925 } 966 926 … … 1155 1115 irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); 1156 1116 } 1117 1118 1119 1120 #if 0 1121 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 else 1149 channel = g_strdup( cmd[3] ); 1150 } 1151 else 1152 { 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 else 1162 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 else 1185 { 1186 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); 1187 g_free( channel ); 1188 } 1189 #endif 1157 1190 } 1158 1191
Note: See TracChangeset
for help on using the changeset viewer.