Changeset 1c3008a
- Timestamp:
- 2009-12-13T14:48:56Z (15 years ago)
- Branches:
- master
- Children:
- e8c8d00
- Parents:
- 2288705
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
r2288705 r1c3008a 115 115 { 116 116 file_transfer_t *file = g_new0( file_transfer_t, 1 ); 117 dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1); 117 dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1 ); 118 118 119 file->file_size = file_size; 119 120 file->file_name = g_strdup( file_name ); … … 144 145 /* listen and request */ 145 146 146 if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 ) { 147 if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 ) 148 { 147 149 dcc_abort( df, "Failed to listen locally, check your ft_listen setting in bitlbee.conf: %s", errmsg ); 148 150 return NULL; … … 161 163 df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df ); 162 164 163 imcb_log( ic, "File transfer request from %s for %s (%zd kb). ", user_nick, file_name, file_size/1024 ); 164 165 imcb_log( ic, "Accept the file transfer if you'd like the file. If you don't, issue the 'transfers reject' command."); 165 imcb_log( ic, "File transfer request from %s for %s (%zd kb).\n" 166 "Accept the file transfer if you'd like the file. If you don't, " 167 "issue the 'transfers reject' command.", 168 user_nick, file_name, file_size / 1024 ); 166 169 167 170 return file; … … 199 202 /* no progress. cancel */ 200 203 if( df->bytes_sent == 0 ) 201 return dcc_abort( df, "Couldn t establish transfer within %d seconds", DCC_MAX_STALL );204 return dcc_abort( df, "Couldn't establish transfer within %d seconds", DCC_MAX_STALL ); 202 205 else 203 206 return dcc_abort( df, "Transfer stalled for %d seconds at %d kb", DCC_MAX_STALL, df->bytes_sent / 1024 ); … … 230 233 ntohl( saddr_ipv4->sin_addr.s_addr ) ); 231 234 port = saddr_ipv4->sin_port; 232 } else 235 } 236 else 233 237 { 234 238 struct sockaddr_in6 *saddr_ipv6 = ( struct sockaddr_in6 *) saddr; … … 250 254 251 255 if ( !irc_msgfrom( df->ic->irc, user_nick, cmd ) ) 252 return dcc_abort( df, " couldn't send 'DCC SEND' message to %s", user_nick );256 return dcc_abort( df, "Couldn't send `DCC SEND' message to %s.", user_nick ); 253 257 254 258 g_free( cmd ); … … 313 317 short revents; 314 318 315 if( !dcc_poll( df, fd, &revents ) )319 if( !dcc_poll( df, fd, &revents ) ) 316 320 return FALSE; 317 321 … … 349 353 int ret; 350 354 351 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received 355 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), MSG_PEEK ), "Receiving" ); 352 356 353 357 if( ret == 0 ) … … 356 360 if( ret < 4 ) 357 361 { 358 imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only 2 bytes instead of 4, shouldn't happen too often!");362 imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only %d bytes instead of 4, shouldn't happen too often!", ret ); 359 363 return TRUE; 360 364 } 361 365 362 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received 366 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), 0 ), "Receiving" ); 363 367 if( ret != 4 ) 364 368 return dcc_abort( df, "MSG_PEEK'ed 4, but can only dequeue %d bytes", ret ); … … 400 404 return dcc_abort( df, "BUG: protocol didn't register write()" ); 401 405 402 ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ) 406 ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ), "Opening Socket" ); 403 407 404 408 sock_make_nonblocking( fd ); … … 429 433 } 430 434 431 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond )435 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond ) 432 436 { 433 437 dcc_file_transfer_t *df = data; -
protocols/jabber/Makefile
r2288705 r1c3008a 10 10 11 11 # [SH] Program variables 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o s asl.o si.o s5bytestream.o12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o s5bytestream.o sasl.o si.o 13 13 14 14 CFLAGS += -Wall -
protocols/jabber/iq.c
r2288705 r1c3008a 99 99 XMLNS_MUC, 100 100 XMLNS_PING, 101 102 103 101 XMLNS_SI, 102 XMLNS_BYTESTREAMS, 103 XMLNS_FILETRANSFER, 104 104 NULL }; 105 105 const char **f; … … 127 127 else if( strcmp( type, "set" ) == 0 ) 128 128 { 129 if( 130 129 if( ( c = xt_find_node( node->children, "si" ) ) && 130 ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) ) 131 131 { 132 132 return jabber_si_handle_request( ic, node, c ); 133 } else if( !( c = xt_find_node( node->children, "query" ) ) || 134 !( s = xt_find_attr( c, "xmlns" ) ) ) 133 } 134 else if( !( c = xt_find_node( node->children, "query" ) ) || 135 !( s = xt_find_attr( c, "xmlns" ) ) ) 135 136 { 136 137 imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type ); 137 138 return XT_HANDLED; 138 } else if( strcmp( s, XMLNS_ROSTER ) == 0 ) 139 } 140 else if( strcmp( s, XMLNS_ROSTER ) == 0 ) 139 141 { 140 142 /* This is a roster push. XMPP servers send this when someone … … 160 162 pack = 0; 161 163 } 162 } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 ) 163 { 164 /* Bytestream Request (stage 2 of file transfer) */ 164 } 165 else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 ) 166 { 167 /* Bytestream Request (stage 2 of file transfer) */ 165 168 return jabber_bs_recv_request( ic, node, c ); 166 } else 169 } 170 else 167 171 { 168 172 xt_free_node( reply ); … … 655 659 656 660 c = c->children; 657 while( ( c = xt_find_node( c, "feature" ) ) ) { 661 while( ( c = xt_find_node( c, "feature" ) ) ) 662 { 658 663 feature = xt_find_attr( c, "var" ); 659 bud->features = g_slist_append( bud->features, g_strdup(feature) );664 bud->features = g_slist_append( bud->features, g_strdup( feature ) ); 660 665 c = c->next; 661 666 } … … 719 724 c = c->next; 720 725 } 721 } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) 726 } 727 else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) 722 728 { 723 729 char *category, *type; … … 737 743 c = c->next; 738 744 } 739 } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_BYTESTREAMS ) == 0 ) 745 } 746 else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_BYTESTREAMS ) == 0 ) 740 747 { 741 748 char *host, *jid; … … 761 768 if( jd->have_streamhosts == 0 ) 762 769 jd->have_streamhosts++; 770 763 771 return XT_HANDLED; 764 772 } -
protocols/jabber/jabber.c
r2288705 r1c3008a 63 63 64 64 s = set_add( &acc->set, "priority", "0", set_eval_priority, acc ); 65 66 s = set_add( &acc->set, "proxy", "<local>;<auto>", NULL, acc ); 65 67 66 68 s = set_add( &acc->set, "resource", "BitlBee", NULL, acc ); … … 80 82 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); 81 83 s->flags |= ACC_SET_OFFLINE_ONLY; 82 83 s = set_add( &acc->set, "proxy", "<local>;<auto>", NULL, acc );84 84 } 85 85 -
protocols/jabber/jabber.h
r2288705 r1c3008a 60 60 } jabber_buddy_flags_t; 61 61 62 /* Stores a streamhost's (a.k.a. proxy) data */62 /* Stores a streamhost's (a.k.a. proxy) data */ 63 63 typedef struct 64 64 { -
protocols/msn/Makefile
r2288705 r1c3008a 10 10 11 11 # [SH] Program variables 12 objects = msn.o msn_util.o ns.o passport.o sb.o tables.o invitation.o12 objects = invitation.o msn.o msn_util.o ns.o passport.o sb.o tables.o 13 13 14 14 CFLAGS += -Wall -
protocols/msn/msn.c
r2288705 r1c3008a 78 78 { 79 79 while( md->filetransfers ) { 80 imcb_file_canceled( md->filetransfers->data, "Closing msnconnection" );80 imcb_file_canceled( md->filetransfers->data, "Closing connection" ); 81 81 } 82 82 -
protocols/msn/sb.c
r2288705 r1c3008a 174 174 buf = g_new0( char, i ); 175 175 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user ); 176 } else if( strncmp( text, MSN_INVITE_HEADERS, sizeof( MSN_INVITE_HEADERS ) - 1 ) == 0 ) 176 } 177 else if( strncmp( text, MSN_INVITE_HEADERS, sizeof( MSN_INVITE_HEADERS ) - 1 ) == 0 ) 177 178 { 178 179 buf = g_strdup( text ); 179 180 i = strlen( buf ); 180 } else 181 } 182 else 181 183 { 182 184 buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 + 1 );
Note: See TracChangeset
for help on using the changeset viewer.