diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-11 16:37:06 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-11 16:37:06 +0200 |
commit | 17a6ee93f4fbefe8b4356d884fdd95f4e72ce8cc (patch) | |
tree | 7f710dd5f451c3ea3a0c5b404ca7b7aad053c263 | |
parent | 1f92a5851e0e3b1730e940980f2b0122c506c724 (diff) |
Including DCC stuff again, with a wonderful extra layer of abstraction.
Some hooks are missing so sending files doesn't work yet. Receiving also
still seems to have some issues. On the plus side, at least the MSN/Jabber
modules work again.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dcc.c | 69 | ||||
-rw-r--r-- | dcc.h | 9 | ||||
-rw-r--r-- | irc_im.c | 33 | ||||
-rw-r--r-- | protocols/Makefile | 2 | ||||
-rw-r--r-- | protocols/bee.h | 5 | ||||
-rw-r--r-- | protocols/bee_ft.c | 66 | ||||
-rw-r--r-- | protocols/ft.h | 6 | ||||
-rw-r--r-- | protocols/jabber/iq.c | 4 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 2 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 8 | ||||
-rw-r--r-- | protocols/jabber/s5bytestream.c | 14 | ||||
-rw-r--r-- | protocols/jabber/si.c | 10 | ||||
-rw-r--r-- | protocols/msn/Makefile | 2 | ||||
-rw-r--r-- | protocols/msn/msn.c | 4 | ||||
-rw-r--r-- | protocols/msn/msn_util.c | 3 | ||||
-rw-r--r-- | protocols/msn/sb.c | 3 | ||||
-rw-r--r-- | protocols/nogaim.c | 2 |
18 files changed, 157 insertions, 87 deletions
@@ -10,7 +10,7 @@ # Program variables #objects = bitlbee.o chat.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) -objects = bitlbee.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o storage.o $(STORAGE_OBJS) +objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o storage.o $(STORAGE_OBJS) headers = account.h bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h subdirs = lib protocols @@ -60,55 +60,16 @@ unsigned int local_transfer_id=1; */ unsigned int receivedchunks=0, receiveddata=0; -static void dcc_finish( file_transfer_t *file ); -static void dcc_close( file_transfer_t *file ); +void dcc_finish( file_transfer_t *file ); +void dcc_close( file_transfer_t *file ); gboolean dccs_send_proto( gpointer data, gint fd, b_input_condition cond ); -int dccs_send_request( struct dcc_file_transfer *df, char *user_nick, struct sockaddr_storage *saddr ); -gboolean dccs_recv_start( file_transfer_t *ft ); +int dccs_send_request( struct dcc_file_transfer *df, irc_user_t *iu, struct sockaddr_storage *saddr ); gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond); gboolean dccs_recv_write_request( file_transfer_t *ft ); gboolean dcc_progress( gpointer data, gint fd, b_input_condition cond ); gboolean dcc_abort( dcc_file_transfer_t *df, char *reason, ... ); -/* As defined in ft.h */ -file_transfer_t *imcb_file_send_start( struct im_connection *ic, char *handle, char *file_name, size_t file_size ) -{ - user_t *u = user_findhandle( ic, handle ); - /* one could handle this more intelligent like imcb_buddy_msg. - * can't call it directly though cause it does some wrapping. - * Maybe give imcb_buddy_msg a parameter NO_WRAPPING? */ - if (!u) return NULL; - - return dccs_send_start( ic, u->nick, file_name, file_size ); -}; - -/* As defined in ft.h */ -void imcb_file_canceled( file_transfer_t *file, char *reason ) -{ - if( file->canceled ) - file->canceled( file, reason ); - - dcc_close( file ); -} - -/* As defined in ft.h */ -gboolean imcb_file_recv_start( file_transfer_t *ft ) -{ - return dccs_recv_start( ft ); -} - -/* As defined in ft.h */ -void imcb_file_finished( file_transfer_t *file ) -{ - dcc_file_transfer_t *df = file->priv; - - if( file->bytes_transferred >= file->file_size ) - dcc_finish( file ); - else - df->proto_finished = TRUE; -} - -dcc_file_transfer_t *dcc_alloc_transfer( char *file_name, size_t file_size, struct im_connection *ic ) +dcc_file_transfer_t *dcc_alloc_transfer( const char *file_name, size_t file_size, struct im_connection *ic ) { file_transfer_t *file = g_new0( file_transfer_t, 1 ); dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1 ); @@ -123,10 +84,11 @@ dcc_file_transfer_t *dcc_alloc_transfer( char *file_name, size_t file_size, stru } /* This is where the sending magic starts... */ -file_transfer_t *dccs_send_start( struct im_connection *ic, char *user_nick, char *file_name, size_t file_size ) +file_transfer_t *dccs_send_start( struct im_connection *ic, irc_user_t *iu, const char *file_name, size_t file_size ) { file_transfer_t *file; dcc_file_transfer_t *df; + irc_t *irc = (irc_t *) ic->bee->ui_data; struct sockaddr_storage saddr; char *errmsg; char host[HOST_NAME_MAX]; @@ -149,20 +111,20 @@ file_transfer_t *dccs_send_start( struct im_connection *ic, char *user_nick, cha file->status = FT_STATUS_LISTENING; - if( !dccs_send_request( df, user_nick, &saddr ) ) + if( !dccs_send_request( df, iu, &saddr ) ) return NULL; /* watch */ df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_send_proto, df ); - df->ic->irc->file_transfers = g_slist_prepend( df->ic->irc->file_transfers, file ); + irc->file_transfers = g_slist_prepend( irc->file_transfers, file ); df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df ); imcb_log( ic, "File transfer request from %s for %s (%zd kb).\n" "Accept the file transfer if you'd like the file. If you don't, " "issue the 'transfers reject' command.", - user_nick, file_name, file_size / 1024 ); + iu->nick, file_name, file_size / 1024 ); return file; } @@ -215,7 +177,7 @@ gboolean dcc_progress( gpointer data, gint fd, b_input_condition cond ) return dcc_abort( df , msg ": %s", strerror( errno ) ); /* Creates the "DCC SEND" line and sends it to the server */ -int dccs_send_request( struct dcc_file_transfer *df, char *user_nick, struct sockaddr_storage *saddr ) +int dccs_send_request( struct dcc_file_transfer *df, irc_user_t *iu, struct sockaddr_storage *saddr ) { char ipaddr[INET6_ADDRSTRLEN]; const void *netaddr; @@ -249,8 +211,7 @@ int dccs_send_request( struct dcc_file_transfer *df, char *user_nick, struct soc cmd = g_strdup_printf( "\001DCC SEND %s %s %u %zu\001", df->ft->file_name, ipaddr, port, df->ft->file_size ); - if ( !irc_msgfrom( df->ic->irc, user_nick, cmd ) ) - return dcc_abort( df, "Couldn't send `DCC SEND' message to %s.", user_nick ); + irc_send_msg_raw( iu, "PRIVMSG", iu->irc->user->nick, cmd ); g_free( cmd ); @@ -495,9 +456,10 @@ gboolean dccs_send_write( file_transfer_t *file, char *data, unsigned int data_l /* * Cleans up after a transfer. */ -static void dcc_close( file_transfer_t *file ) +void dcc_close( file_transfer_t *file ) { dcc_file_transfer_t *df = file->priv; + irc_t *irc = (irc_t *) df->ic->bee->ui_data; if( file->free ) file->free( file ); @@ -513,7 +475,7 @@ static void dcc_close( file_transfer_t *file ) if( df->progress_timeout ) b_event_remove( df->progress_timeout ); - df->ic->irc->file_transfers = g_slist_remove( df->ic->irc->file_transfers, file ); + irc->file_transfers = g_slist_remove( irc->file_transfers, file ); g_free( df ); g_free( file->file_name ); @@ -543,6 +505,7 @@ void dcc_finish( file_transfer_t *file ) */ file_transfer_t *dcc_request( struct im_connection *ic, char *line ) { + irc_t *irc = (irc_t *) ic->bee->ui_data; char *pattern = "SEND" " (([^\"][^ ]*)|\"(([^\"]|\\\")*)\")" " (([0-9]*)|([^ ]*))" @@ -626,7 +589,7 @@ file_transfer_t *dcc_request( struct im_connection *ic, char *line ) freeaddrinfo( rp ); g_free( input ); - df->ic->irc->file_transfers = g_slist_prepend( df->ic->irc->file_transfers, ft ); + irc->file_transfers = g_slist_prepend( irc->file_transfers, ft ); return ft; } @@ -94,11 +94,12 @@ typedef struct dcc_file_transfer { int proto_finished; } dcc_file_transfer_t; -file_transfer_t *dccs_send_start( struct im_connection *ic, char *user_nick, char *file_name, size_t file_size ); - +file_transfer_t *dccs_send_start( struct im_connection *ic, irc_user_t *iu, const char *file_name, size_t file_size ); void dcc_canceled( file_transfer_t *file, char *reason ); - gboolean dccs_send_write( file_transfer_t *file, char *data, unsigned int data_size ); - file_transfer_t *dcc_request( struct im_connection *ic, char *line ); +void dcc_finish( file_transfer_t *file ); +void dcc_close( file_transfer_t *file ); +gboolean dccs_recv_start( file_transfer_t *ft ); + #endif @@ -24,7 +24,7 @@ */ #include "bitlbee.h" - +#include "dcc.h" /* IM->IRC callbacks */ @@ -160,12 +160,43 @@ static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu ) return TRUE; } +/* File transfers */ +static file_transfer_t *bee_irc_ft_in_start( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size ) +{ + return dccs_send_start( bu->ic, (irc_user_t *) bu->ui_data, file_name, file_size ); +} + +gboolean bee_irc_ft_out_start( struct im_connection *ic, file_transfer_t *ft ) +{ + return dccs_recv_start( ft ); +} + +void bee_irc_ft_close( struct im_connection *ic, file_transfer_t *ft ) +{ + return dcc_close( ft ); +} + +void bee_irc_ft_finished( struct im_connection *ic, file_transfer_t *file ) +{ + dcc_file_transfer_t *df = file->priv; + + if( file->bytes_transferred >= file->file_size ) + dcc_finish( file ); + else + df->proto_finished = TRUE; +} + const struct bee_ui_funcs irc_ui_funcs = { bee_irc_user_new, bee_irc_user_free, bee_irc_user_fullname, bee_irc_user_status, bee_irc_user_msg, + + bee_irc_ft_in_start, + bee_irc_ft_out_start, + bee_irc_ft_close, + bee_irc_ft_finished, }; diff --git a/protocols/Makefile b/protocols/Makefile index 4d461088..46c73559 100644 --- a/protocols/Makefile +++ b/protocols/Makefile @@ -9,7 +9,7 @@ -include ../Makefile.settings # [SH] Program variables -objects = account.o bee.o bee_user.o nogaim.o +objects = account.o bee.o bee_ft.o bee_user.o nogaim.o # [SH] The next two lines should contain the directory name (in $(subdirs)) diff --git a/protocols/bee.h b/protocols/bee.h index 61604265..6f896c51 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -70,6 +70,11 @@ typedef struct bee_ui_funcs gboolean (*user_fullname)( bee_t *bee, bee_user_t *bu ); gboolean (*user_status)( bee_t *bee, struct bee_user *bu, struct bee_user *old ); gboolean (*user_msg)( bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at ); + + struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size ); + gboolean (*ft_out_start)( struct im_connection *ic, struct file_transfer *ft ); + void (*ft_close)( struct im_connection *ic, struct file_transfer *ft ); + void (*ft_finished)( struct im_connection *ic, struct file_transfer *ft ); } bee_ui_funcs_t; diff --git a/protocols/bee_ft.c b/protocols/bee_ft.c new file mode 100644 index 00000000..1026eab3 --- /dev/null +++ b/protocols/bee_ft.c @@ -0,0 +1,66 @@ +/********************************************************************\ +* BitlBee -- An IRC to other IM-networks gateway * +* * +* Copyright 2010 Wilmer van der Gaast <wilmer@gaast.net> * +\********************************************************************/ + +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License with + the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA +*/ + +#define BITLBEE_CORE +#include "bitlbee.h" +#include "ft.h" + +file_transfer_t *imcb_file_send_start( struct im_connection *ic, char *handle, char *file_name, size_t file_size ) +{ + bee_t *bee = ic->bee; + bee_user_t *bu = bee_user_by_handle( bee, ic, handle ); + + if( bee->ui->ft_in_start ) + return bee->ui->ft_in_start( bee, bu, file_name, file_size ); + else + return NULL; +} + +gboolean imcb_file_recv_start( struct im_connection *ic, file_transfer_t *ft ) +{ + bee_t *bee = ic->bee; + + if( bee->ui->ft_out_start ) + return bee->ui->ft_out_start( ic, ft ); + else + return FALSE; +} + +void imcb_file_canceled( struct im_connection *ic, file_transfer_t *file, char *reason ) +{ + bee_t *bee = ic->bee; + + if( file->canceled ) + file->canceled( file, reason ); + + if( bee->ui->ft_close ) + bee->ui->ft_close( ic, file ); +} + +void imcb_file_finished( struct im_connection *ic, file_transfer_t *file ) +{ + bee_t *bee = ic->bee; + + if( bee->ui->ft_finished ) + bee->ui->ft_finished( ic, file ); +} diff --git a/protocols/ft.h b/protocols/ft.h index 1155f06f..c1ee2b49 100644 --- a/protocols/ft.h +++ b/protocols/ft.h @@ -167,9 +167,9 @@ file_transfer_t *imcb_file_send_start( struct im_connection *ic, char *user_nick * This should be called by a protocol when the transfer is canceled. Note that * the canceled() and free() callbacks given in file will be called by this function. */ -void imcb_file_canceled( file_transfer_t *file, char *reason ); +void imcb_file_canceled( struct im_connection *ic, file_transfer_t *file, char *reason ); -gboolean imcb_file_recv_start( file_transfer_t *ft ); +gboolean imcb_file_recv_start( struct im_connection *ic, file_transfer_t *ft ); -void imcb_file_finished( file_transfer_t *file ); +void imcb_file_finished( struct im_connection *ic, file_transfer_t *file ); #endif diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index f5fbdc13..bdedeb08 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -391,7 +391,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * { if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) { - if( initial || imcb_find_buddy( ic, jid ) == NULL ) + if( initial || bee_user_by_handle( ic->bee, ic, jid ) == NULL ) imcb_add_buddy( ic, jid, ( group && group->text_len ) ? group->text : NULL ); @@ -589,7 +589,7 @@ static xt_status jabber_add_to_roster_callback( struct im_connection *ic, struct ( s = xt_find_attr( node, "type" ) ) && strcmp( s, "result" ) == 0 ) { - if( imcb_find_buddy( ic, jid ) == NULL ) + if( bee_user_by_handle( ic->bee, ic, jid ) == NULL ) imcb_add_buddy( ic, jid, NULL ); } else diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 956769b7..acad525e 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -266,7 +266,7 @@ static void jabber_logout( struct im_connection *ic ) struct jabber_data *jd = ic->proto_data; while( jd->filetransfers ) - imcb_file_canceled( ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" ); + imcb_file_canceled( ic, ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" ); while( jd->streamhosts ) { diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index bd2fbe8c..6f58f124 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -278,8 +278,7 @@ static void jabber_buddy_ask_yes( void *data ) presence_send_request( bla->ic, bla->handle, "subscribed" ); - if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) - imcb_ask_add( bla->ic, bla->handle, NULL ); + imcb_ask_add( bla->ic, bla->handle, NULL ); g_free( bla->handle ); g_free( bla ); @@ -461,7 +460,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, } if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && - ( bare_exists || imcb_find_buddy( ic, jid ) ) ) + ( bare_exists || bee_user_by_handle( ic->bee, ic, jid ) ) ) { *s = '/'; bud = jabber_buddy_add( ic, jid ); @@ -482,7 +481,8 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, if( bud == NULL ) /* No match. Create it now? */ - return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ? + return ( ( flags & GET_BUDDY_CREAT ) && + bee_user_by_handle( ic->bee, ic, jid_ ) ) ? jabber_buddy_add( ic, jid_ ) : NULL; else if( bud->resource && ( flags & GET_BUDDY_EXACT ) ) /* We want an exact match, so in thise case there shouldn't be a /resource. */ diff --git a/protocols/jabber/s5bytestream.c b/protocols/jabber/s5bytestream.c index 58a6c2e4..4896e380 100644 --- a/protocols/jabber/s5bytestream.c +++ b/protocols/jabber/s5bytestream.c @@ -565,7 +565,7 @@ gboolean jabber_bs_recv_handshake_abort( struct bs_transfer *bt, char *error ) imcb_log( tf->ic, "WARNING: Error transmitting bytestream response" ); xt_free_node( reply ); - imcb_file_canceled( tf->ft, "couldn't connect to any streamhosts" ); + imcb_file_canceled( tf->ic, tf->ft, "couldn't connect to any streamhosts" ); bt->tf->watch_in = 0; /* MUST always return FALSE! */ @@ -602,7 +602,7 @@ void jabber_bs_recv_answer_request( struct bs_transfer *bt ) xt_add_attr( reply, "id", tf->iq_id ); if( !jabber_write_packet( tf->ic, reply ) ) - imcb_file_canceled( tf->ft, "Error transmitting bytestream response" ); + imcb_file_canceled( tf->ic, tf->ft, "Error transmitting bytestream response" ); xt_free_node( reply ); } @@ -642,7 +642,7 @@ gboolean jabber_bs_recv_read( gpointer data, gint fd, b_input_condition cond ) tf->bytesread += ret; if( tf->bytesread >= tf->ft->file_size ) - imcb_file_finished( tf->ft ); + imcb_file_finished( tf->ic, tf->ft ); tf->ft->write( tf->ft, tf->ft->buffer, ret ); @@ -658,7 +658,7 @@ gboolean jabber_bs_recv_write_request( file_transfer_t *ft ) if( tf->watch_in ) { - imcb_file_canceled( ft, "BUG in jabber file transfer: write_request called when already watching for input" ); + imcb_file_canceled( tf->ic, ft, "BUG in jabber file transfer: write_request called when already watching for input" ); return FALSE; } @@ -704,7 +704,7 @@ gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int l return jabber_bs_abort( bt, "send() sent %d instead of %d (send buffer too big!)", ret, len ); if( tf->byteswritten >= ft->file_size ) - imcb_file_finished( ft ); + imcb_file_finished( tf->ic, ft ); else bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt ); @@ -1004,7 +1004,7 @@ gboolean jabber_bs_send_request( struct jabber_transfer *tf, GSList *streamhosts jabber_cache_add( tf->ic, iq, jabber_bs_send_handle_reply ); if( !jabber_write_packet( tf->ic, iq ) ) - imcb_file_canceled( tf->ft, "Error transmitting bytestream request" ); + imcb_file_canceled( tf->ic, tf->ft, "Error transmitting bytestream request" ); return TRUE; } @@ -1019,7 +1019,7 @@ gboolean jabber_bs_send_handshake_abort(struct bs_transfer *bt, char *error ) error ); if( jd->streamhosts==NULL ) /* we're done here unless we have a proxy to try */ - imcb_file_canceled( tf->ft, error ); + imcb_file_canceled( tf->ic, tf->ft, error ); /* MUST always return FALSE! */ return FALSE; diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c index bfb64f11..58c0e17f 100644 --- a/protocols/jabber/si.c +++ b/protocols/jabber/si.c @@ -90,11 +90,11 @@ int jabber_si_check_features( struct jabber_transfer *tf, GSList *features ) { } if( !foundft ) - imcb_file_canceled( tf->ft, "Buddy's client doesn't feature file transfers" ); + imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature file transfers" ); else if( !foundbt ) - imcb_file_canceled( tf->ft, "Buddy's client doesn't feature byte streams (required)" ); + imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature byte streams (required)" ); else if( !foundsi ) - imcb_file_canceled( tf->ft, "Buddy's client doesn't feature stream initiation (required)" ); + imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature stream initiation (required)" ); return foundft && foundbt && foundsi; } @@ -108,7 +108,7 @@ void jabber_si_transfer_start( struct jabber_transfer *tf ) { jabber_si_send_request( tf->ic, tf->bud->full_jid, tf ); /* and start the receive logic */ - imcb_file_recv_start( tf->ft ); + imcb_file_recv_start( tf->ic, tf->ft ); } @@ -155,7 +155,7 @@ void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft, if( bud == NULL ) { - imcb_file_canceled( ft, "Couldn't find buddy (BUG?)" ); + imcb_file_canceled( ic, ft, "Couldn't find buddy (BUG?)" ); return; } diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile index 5d199b9e..6a588613 100644 --- a/protocols/msn/Makefile +++ b/protocols/msn/Makefile @@ -9,7 +9,7 @@ -include ../../Makefile.settings # [SH] Program variables -objects = invitation.o msn.o msn_util.o ns.o passport.o sb.o tables.o +objects = msn.o msn_util.o ns.o passport.o sb.o tables.o CFLAGS += -Wall LFLAGS += -r diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 3a8b8f7b..8b73f103 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -80,9 +80,11 @@ static void msn_logout( struct im_connection *ic ) if( md ) { + /** Disabling MSN ft support for now. while( md->filetransfers ) { imcb_file_canceled( md->filetransfers->data, "Closing connection" ); } + */ if( md->fd >= 0 ) closesocket( md->fd ); @@ -343,7 +345,7 @@ void msn_initmodule() ret->rem_deny = msn_rem_deny; ret->send_typing = msn_send_typing; ret->handle_cmp = g_strcasecmp; - ret->transfer_request = msn_ftp_transfer_request; + //ret->transfer_request = msn_ftp_transfer_request; register_protocol(ret); } diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index 668a8b8a..f85981e5 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -95,8 +95,7 @@ static void msn_buddy_ask_yes( void *data ) msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); - if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) - imcb_ask_add( bla->ic, bla->handle, NULL ); + imcb_ask_add( bla->ic, bla->handle, NULL ); g_free( bla->handle ); g_free( bla->realname ); diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index c3302e57..a935ce97 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -690,6 +690,8 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int /* PANIC! */ } } +#if 0 + // Disable MSN ft support for now. else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 ) { char *command = msn_findheader( body, "Invitation-Command:", blen ); @@ -722,6 +724,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int g_free( command ); } +#endif else if( g_strncasecmp( ct, "application/x-msnmsgrp2p", 24 ) == 0 ) { imcb_error( sb->ic, "Cannot receive file from %s: BitlBee does not " diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 1e00d5ab..4521eb32 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -390,7 +390,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char if( !bu || !fullname ) return; - if( strcmp( bu->fullname, fullname ) != 0 ) + if( !bu->fullname || strcmp( bu->fullname, fullname ) != 0 ) { g_free( bu->fullname ); bu->fullname = g_strdup( fullname ); |