diff options
Diffstat (limited to 'protocols/purple')
| -rw-r--r-- | protocols/purple/ft.c | 14 | ||||
| -rw-r--r-- | protocols/purple/purple.c | 17 | 
2 files changed, 19 insertions, 12 deletions
diff --git a/protocols/purple/ft.c b/protocols/purple/ft.c index e3a89524..c4efc657 100644 --- a/protocols/purple/ft.c +++ b/protocols/purple/ft.c @@ -74,6 +74,7 @@ static void prplcb_xfer_new( PurpleXfer *xfer )  		px->xfer = xfer;  		px->fn = mktemp( g_strdup( "/tmp/bitlbee-purple-ft.XXXXXX" ) );  		px->fd = -1; +		px->ic = purple_ic_by_pa( xfer->account );  		purple_xfer_set_local_filename( xfer, px->fn ); @@ -142,14 +143,14 @@ gboolean try_write_to_ui( gpointer data, gint fd, b_input_condition cond )  		else  		{  			purple_xfer_cancel_local( px->xfer ); -			imcb_file_canceled( ft, "Read error" ); +			imcb_file_canceled( px->ic, ft, "Read error" );  		}  	}  	if( lseek( px->fd, 0, SEEK_CUR ) == px->xfer->size )  	{  		/*purple_xfer_end( px->xfer );*/ -		imcb_file_finished( ft ); +		imcb_file_finished( px->ic, ft );  	}  	return FALSE; @@ -229,7 +230,7 @@ static void prplcb_xfer_cancel_remote( PurpleXfer *xfer )  	struct prpl_xfer_data *px = xfer->ui_data;  	if( px->ft ) -		imcb_file_canceled( px->ft, "Canceled by remote end" ); +		imcb_file_canceled( px->ic, px->ft, "Canceled by remote end" );  	else  		/* px->ft == NULL for sends, because of the two stages. :-/ */  		imcb_error( px->ic, "File transfer cancelled by remote end" ); @@ -300,11 +301,12 @@ static void purple_transfer_forward( struct file_transfer *ft )  static gboolean purple_transfer_request_cb( gpointer data, gint fd, b_input_condition cond )  {  	file_transfer_t *ft = data; +	struct prpl_xfer_data *px = ft->data;  	if( ft->write == NULL )  	{  		ft->write = prpl_xfer_write; -		imcb_file_recv_start( ft ); +		imcb_file_recv_start( px->ic, ft );  	}  	ft->write_request( ft ); @@ -318,7 +320,7 @@ static gboolean prpl_xfer_write( struct file_transfer *ft, char *buffer, unsigne  	if( write( px->fd, buffer, len ) != len )  	{ -		imcb_file_canceled( ft, "Error while writing temporary file" ); +		imcb_file_canceled( px->ic, ft, "Error while writing temporary file" );  		return FALSE;  	} @@ -328,7 +330,7 @@ static gboolean prpl_xfer_write( struct file_transfer *ft, char *buffer, unsigne  		px->fd = -1;  		purple_transfer_forward( ft ); -		imcb_file_finished( ft ); +		imcb_file_finished( px->ic, ft );  		px->ft = NULL;  	}  	else diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 98cd2241..16ca01de 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -34,7 +34,7 @@ GSList *purple_connections;  /* This makes me VERY sad... :-( But some libpurple callbacks come in without     any context so this is the only way to get that. Don't want to support     libpurple in daemon mode anyway. */ -static irc_t *local_irc; +static bee_t *local_bee;  static char *set_eval_display_name( set_t *set, char *value ); @@ -156,8 +156,11 @@ static void purple_init( account_t *acc )  			break;  		default: +			/** No way to talk to the user right now, invent one when +			this becomes important.  			irc_usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",  			             name, purple_account_option_get_type( o ) ); +			*/  			name = NULL;  		} @@ -250,13 +253,14 @@ static void purple_login( account_t *acc )  	struct im_connection *ic = imcb_new( acc );  	PurpleAccount *pa; -	if( local_irc != NULL && local_irc != acc->irc ) +	if( local_bee != NULL && local_bee != acc->bee )  	{ -		irc_usermsg( acc->irc, "Daemon mode detected. Do *not* try to use libpurple in daemon mode! " -		                       "Please use inetd or ForkDaemon mode instead." ); +		imcb_error( ic,  "Daemon mode detected. Do *not* try to use libpurple in daemon mode! " +		                 "Please use inetd or ForkDaemon mode instead." ); +		imc_logout( ic, FALSE );  		return;  	} -	local_irc = acc->irc; +	local_bee = acc->bee;  	/* For now this is needed in the _connected() handlers if using  	   GLib event handling, to make sure we're not handling events @@ -865,8 +869,9 @@ static void *prplcb_request_action( const char *title, const char *primary, cons  	pqad->user_data = user_data; +	/* TODO: IRC stuff here :-( */  	q = g_strdup_printf( "Request: %s\n\n%s\n\n%s", title, primary, secondary ); -	pqad->bee_data = query_add( local_irc, purple_ic_by_pa( account ), q, +	pqad->bee_data = query_add( local_bee->ui_data, purple_ic_by_pa( account ), q,  		prplcb_request_action_yes, prplcb_request_action_no, pqad );  	g_free( q );  | 
