Changes in root_commands.c [2c2df7d:56f260a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
r2c2df7d r56f260a 972 972 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); 973 973 g_free( channel ); 974 }975 }976 977 static void cmd_transfers( irc_t *irc, char **cmd )978 {979 GSList *files = irc->file_transfers;980 enum { LIST, REJECT, CANCEL };981 int subcmd = LIST;982 int fid;983 984 if( !files )985 {986 irc_usermsg( irc, "No pending transfers" );987 return;988 }989 990 if( cmd[1] &&991 ( strcmp( cmd[1], "reject" ) == 0 ) )992 {993 subcmd = REJECT;994 }995 else if( cmd[1] &&996 ( strcmp( cmd[1], "cancel" ) == 0 ) &&997 cmd[2] &&998 ( fid = atoi( cmd[2] ) ) )999 {1000 subcmd = CANCEL;1001 }1002 1003 for( ; files; files = g_slist_next( files ) )1004 {1005 file_transfer_t *file = files->data;1006 1007 switch( subcmd ) {1008 case LIST:1009 if ( file->status == FT_STATUS_LISTENING )1010 irc_usermsg( irc,1011 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);1012 else1013 {1014 int kb_per_s = 0;1015 time_t diff = time( NULL ) - file->started;1016 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )1017 kb_per_s = file->bytes_transferred / 1024 / diff;1018 1019 irc_usermsg( irc,1020 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,1021 file->bytes_transferred/1024, file->file_size/1024, kb_per_s);1022 }1023 break;1024 case REJECT:1025 if( file->status == FT_STATUS_LISTENING )1026 {1027 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );1028 imcb_file_canceled( file, "Denied by user" );1029 }1030 break;1031 case CANCEL:1032 if( file->local_id == fid )1033 {1034 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );1035 imcb_file_canceled( file, "Canceled by user" );1036 }1037 break;1038 }1039 974 } 1040 975 } … … 1060 995 { "qlist", 0, cmd_qlist, 0 }, 1061 996 { "join_chat", 2, cmd_join_chat, 0 }, 1062 { "transfers", 0, cmd_transfers, 0 },1063 997 { NULL } 1064 998 };
Note: See TracChangeset
for help on using the changeset viewer.