aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/msn/msn.c29
-rw-r--r--protocols/msn/msn.h1
-rw-r--r--protocols/msn/ns.c15
3 files changed, 40 insertions, 5 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 8e10e202..71570ce0 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -139,6 +139,8 @@ static void msn_logout( struct im_connection *ic )
static int msn_buddy_msg( struct im_connection *ic, char *who, char *message, int away )
{
+ struct bee_user *bu = bee_user_by_handle( ic->bee, ic, who );
+ struct msn_buddy_data *bd = bu ? bu->data : NULL;
struct msn_switchboard *sb;
#ifdef DEBUG
@@ -148,7 +150,11 @@ static int msn_buddy_msg( struct im_connection *ic, char *who, char *message, in
}
else
#endif
- if( ( sb = msn_sb_by_handle( ic, who ) ) )
+ if( bd && bd->flags & MSN_BUDDY_FED )
+ {
+ msn_ns_sendmessage( ic, bu, message );
+ }
+ else if( ( sb = msn_sb_by_handle( ic, who ) ) )
{
return( msn_sb_sendmessage( sb, message ) );
}
@@ -354,8 +360,27 @@ static char *set_eval_display_name( set_t *set, char *value )
static void msn_buddy_data_add( bee_user_t *bu )
{
struct msn_data *md = bu->ic->proto_data;
- bu->data = g_new0( struct msn_buddy_data, 1 );
+ struct msn_buddy_data *bd;
+ char *handle;
+
+ bd = bu->data = g_new0( struct msn_buddy_data, 1 );
g_tree_insert( md->domaintree, bu->handle, bu );
+
+ for( handle = bu->handle; isdigit( *handle ); handle ++ );
+ if( *handle == ':' )
+ {
+ /* Pass a nick hint so hopefully the stupid numeric prefix
+ won't show up to the user. */
+ char *s = strchr( ++handle, '@' );
+ if( s )
+ {
+ handle = g_strndup( handle, s - handle );
+ imcb_buddy_nick_hint( bu->ic, bu->handle, handle );
+ g_free( handle );
+ }
+
+ bd->flags |= MSN_BUDDY_FED;
+ }
}
static void msn_buddy_data_free( bee_user_t *bu )
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index 7c23f282..1dcb0071 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -197,6 +197,7 @@ typedef enum
MSN_BUDDY_RL = 8,
MSN_BUDDY_PL = 16,
MSN_BUDDY_ADL_SYNCED = 256,
+ MSN_BUDDY_FED = 512,
} msn_buddy_flags_t;
struct msn_buddy_data
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index fb85c989..49ccc5de 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -971,18 +971,27 @@ int msn_ns_finish_login( struct im_connection *ic )
int msn_ns_sendmessage( struct im_connection *ic, bee_user_t *bu, const char *text )
{
struct msn_data *md = ic->proto_data;
- char *buf;
+ int type = 0;
+ char *buf, *handle;
if( strncmp( text, "\r\r\r", 3 ) == 0 )
/* Err. Shouldn't happen but I guess it can. Don't send others
any of the "SHAKE THAT THING" messages. :-D */
return 1;
+ /* This might be a federated contact. Get its network number,
+ prefixed to bu->handle with a colon. Default is 1. */
+ for( handle = bu->handle; isdigit( *handle ); handle ++ )
+ type = type * 10 + *handle - '0';
+ if( *handle == ':' )
+ handle ++;
+ else
+ type = 1;
+
buf = g_strdup_printf( "%s%s", MSN_MESSAGE_HEADERS, text );
if( msn_ns_write( ic, -1, "UUM %d %s %d %d %zd\r\n%s",
- ++md->trId, bu->handle,
- 1, /* type == MSN (offline) message */
+ ++md->trId, handle, type,
1, /* type == IM (not nudge/typing) */
strlen( buf ), buf ) )
return 1;