diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/bee.h | 1 | ||||
| -rw-r--r-- | protocols/bee_user.c | 29 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 20 | ||||
| -rw-r--r-- | protocols/msn/soap.h | 48 | 
4 files changed, 76 insertions, 22 deletions
| diff --git a/protocols/bee.h b/protocols/bee.h index 5792e988..6e3cf563 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -147,6 +147,7 @@ void bee_group_free( bee_t *bee );   *   OPT_LOGGED_IN and OPT_AWAY.   * - 'state' and 'message' can be NULL */  G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ); +G_MODULE_EXPORT void imcb_buddy_status_msg( struct im_connection *ic, const char *handle, const char *message );  G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );  /* Call when a handle says something. 'flags' and 'sent_at may be just 0. */  G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, guint32 flags, time_t sent_at ); diff --git a/protocols/bee_user.c b/protocols/bee_user.c index 5acd5b83..86f87f86 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -186,8 +186,13 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags,  	/* TODO(wilmer): OPT_AWAY, or just state == NULL ? */  	bu->flags = flags; -	bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state );  	bu->status_msg = g_strdup( message ); +	if( state && *state ) +		bu->status = g_strdup( state ); +	else if( flags & OPT_AWAY ) +		bu->status = g_strdup( "Away" ); +	else +		bu->status = NULL;  	if( bee->ui->user_status )  		bee->ui->user_status( bee, bu, old ); @@ -197,6 +202,28 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags,  	g_free( old );  } +/* Same, but only change the away/status message, not any away/online state info. */ +void imcb_buddy_status_msg( struct im_connection *ic, const char *handle, const char *message ) +{ +	bee_t *bee = ic->bee; +	bee_user_t *bu, *old; +	 +	if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) +	{ +		return; +	} +	 +	old = g_memdup( bu, sizeof( bee_user_t ) ); +	 +	bu->status_msg = g_strdup( message ); +	 +	if( bee->ui->user_status ) +		bee->ui->user_status( bee, bu, old ); +	 +	g_free( old->status_msg ); +	g_free( old ); +} +  void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle )  {  	bee_t *bee = ic->bee; diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 40f96b21..0c067b8c 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -576,6 +576,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts >= 4 )  			md->handler->msglen = atoi( cmd[3] );  	} +	else if( strcmp( cmd[0], "NOT" ) == 0 ) +	{ +		/* Some kind of notification, not sure if it still exists +		   but we have to skip the payload or stuff breaks. */ +		if( num_parts >= 3 ) +			md->handler->msglen = atoi( cmd[2] ); +	}  	else if( isdigit( cmd[0][0] ) )  	{  		int num = atoi( cmd[0] ); @@ -685,6 +692,19 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int  			g_free( ct );  		}  	} +	else if( strcmp( cmd[0], "UBX" ) == 0 ) +	{ +		struct xt_node *psm; +		char *psm_text = NULL; +		 +		psm = xt_from_string( msg ); +		if( psm && strcmp( psm->name, "Data" ) == 0 && +		    ( psm = xt_find_node( psm->children, "PSM" ) ) ) +			psm_text = psm->text; +		 +		imcb_buddy_status_msg( ic, cmd[1], psm_text ); +		xt_free_node( psm ); +	}  	return( 1 );  } diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index f3231e91..14b0624b 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -1,24 +1,30 @@ -/* soap.h - * - * SOAP-related functions. Some manager at Microsoft apparently thought - * MSNP wasn't XMLy enough so someone stepped up and changed that. This - * is the result. - * - * Copyright (C) 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 version 2                    - * as published by the Free Software Foundation                                      - *                                                                                    - * This program is distributed in the hope that is will be useful,                   - * bit WITHOU 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                 - * along with this program; if not, write to the Free Software                       - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA           - */ +  /********************************************************************\ +  * BitlBee -- An IRC to other IM-networks gateway                     * +  *                                                                    * +  * Copyright 2002-2010 Wilmer van der Gaast and others                * +  \********************************************************************/ + +/* MSN module - All the SOAPy XML stuff. +   Some manager at Microsoft apparently thought MSNP wasn't XMLy enough so +   someone stepped up and changed that. This is the result. Kilobytes and +   more kilobytes of XML vomit to transfer tiny bits of informaiton. */ + +/* +  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 +*/  /* Thanks to http://msnpiki.msnfanatic.com/ for lots of info on this! */ | 
