Changes in root_commands.c [ba7d16f:0baed0d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
rba7d16f r0baed0d 26 26 #define BITLBEE_CORE 27 27 #include "commands.h" 28 #include "crypting.h" 28 29 #include "bitlbee.h" 29 30 #include "help.h" … … 1153 1154 { 1154 1155 irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); 1155 }1156 }1157 1158 static void cmd_transfer( irc_t *irc, char **cmd )1159 {1160 GSList *files = irc->file_transfers;1161 enum { LIST, REJECT, CANCEL };1162 int subcmd = LIST;1163 int fid;1164 1165 if( !files )1166 {1167 irc_usermsg( irc, "No pending transfers" );1168 return;1169 }1170 1171 if( cmd[1] && ( strcmp( cmd[1], "reject" ) == 0 ) )1172 {1173 subcmd = REJECT;1174 }1175 else if( cmd[1] && ( strcmp( cmd[1], "cancel" ) == 0 ) &&1176 cmd[2] && ( sscanf( cmd[2], "%d", &fid ) == 1 ) )1177 {1178 subcmd = CANCEL;1179 }1180 1181 for( ; files; files = g_slist_next( files ) )1182 {1183 file_transfer_t *file = files->data;1184 1185 switch( subcmd ) {1186 case LIST:1187 if ( file->status == FT_STATUS_LISTENING )1188 irc_usermsg( irc,1189 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);1190 else1191 {1192 int kb_per_s = 0;1193 time_t diff = time( NULL ) - file->started ? : 1;1194 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )1195 kb_per_s = file->bytes_transferred / 1024 / diff;1196 1197 irc_usermsg( irc,1198 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,1199 file->bytes_transferred/1024, file->file_size/1024, kb_per_s);1200 }1201 break;1202 case REJECT:1203 if( file->status == FT_STATUS_LISTENING )1204 {1205 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );1206 imcb_file_canceled( file, "Denied by user" );1207 }1208 break;1209 case CANCEL:1210 if( file->local_id == fid )1211 {1212 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );1213 imcb_file_canceled( file, "Canceled by user" );1214 }1215 break;1216 }1217 1156 } 1218 1157 } … … 1239 1178 { "join_chat", 2, cmd_join_chat, 0 }, 1240 1179 { "chat", 1, cmd_chat, 0 }, 1241 { "transfer", 0, cmd_transfer, 0 },1242 1180 { NULL } 1243 1181 };
Note: See TracChangeset
for help on using the changeset viewer.