diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-09-29 20:38:18 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-09-29 20:38:18 +0100 |
commit | 208db4babb7a9be245cedd3a0a4758891fece03d (patch) | |
tree | 8aa07873ba2df5ab24234df3c6a500511993e71b /protocols/msn/ns.c | |
parent | 3901b5dc7145de0db36d4a8820836daf91febc24 (diff) |
Support for sending messages to federated contacts. They don't seem to arrive
but Pidgin seems to have the same problem.
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r-- | protocols/msn/ns.c | 15 |
1 files changed, 12 insertions, 3 deletions
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; |