# HG changeset patch # User Christian Hammond # Date 1052891585 0 # Node ID a87818e9dc54f8f23d180e52747a25637cde9eb8 # Parent c4e7a079cc046c0ea80140f795805ed4cdbd31db [gaim-migrate @ 5745] Pages can now be sent to MSN users that have MSN Mobile setup with a device capable of pages. Right-click and choose "Send to Mobile." Some of the stuff isn't complete. I'm working on it. Also, the interface sucks, but will have to be that way until I do the do_*_dialog() core/ui split. committer: Tailor Script diff -r c4e7a079cc04 -r a87818e9dc54 src/protocols/msn/Makefile.am --- a/src/protocols/msn/Makefile.am Wed May 14 04:35:09 2003 +0000 +++ b/src/protocols/msn/Makefile.am Wed May 14 05:53:05 2003 +0000 @@ -16,6 +16,8 @@ msn.h \ notification.c \ notification.h \ + page.c \ + page.h \ servconn.c \ servconn.h \ session.c \ diff -r c4e7a079cc04 -r a87818e9dc54 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Wed May 14 04:35:09 2003 +0000 +++ b/src/protocols/msn/msn.c Wed May 14 05:53:05 2003 +0000 @@ -21,6 +21,7 @@ */ #include "msn.h" #include "msg.h" +#include "page.h" #include "session.h" #include "state.h" #include "utils.h" @@ -34,6 +35,13 @@ static char *msn_normalize(const char *str); +typedef struct +{ + struct gaim_connection *gc; + const char *passport; + +} MsnMobileData; + static void msn_act_id(gpointer data, char *entry) { @@ -116,6 +124,36 @@ msn_set_prp(gc, "MOB", "N"); } +static void +__send_to_mobile_cb(MsnMobileData *data, const char *entry) +{ + MsnSession *session = data->gc->proto_data; + MsnServConn *servconn = session->notification_conn; + MsnUser *user; + MsnPage *page; + char *page_str; + + user = msn_user_new(session, data->passport, NULL); + + page = msn_page_new(); + msn_page_set_receiver(page, user); + msn_page_set_transaction_id(page, ++session->trId); + msn_page_set_body(page, entry); + + page_str = msn_page_build_string(page); + + msn_user_destroy(user); + msn_page_destroy(page); + + if (!msn_servconn_write(servconn, page_str, strlen(page_str))) { + + hide_login_progress(data->gc, _("Write error")); + signoff(data->gc); + } + + g_free(page_str); +} + /* -- */ static void @@ -185,6 +223,24 @@ session->prpl->handle, FALSE); } +static void +__show_send_to_mobile_cb(struct gaim_connection *gc, const char *passport) +{ + MsnUser *user; + MsnSession *session = gc->proto_data; + MsnMobileData *data; + + user = msn_users_find_with_passport(session->users, passport); + + data = g_new0(MsnMobileData, 1); + data->gc = gc; + data->passport = passport; + + do_prompt_dialog(_("Send message:"), NULL, + data, __send_to_mobile_cb, g_free); +} + + /************************************************************************** * Protocol Plugin ops **************************************************************************/ @@ -312,8 +368,20 @@ static GList * msn_buddy_menu(struct gaim_connection *gc, const char *who) { + struct proto_buddy_menu *pbm; + struct buddy *b; GList *m = NULL; + b = gaim_find_buddy(gc->account, who); + + if (MSN_MOBILE(b->uc)) { + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Send to Mobile"); + pbm->callback = __show_send_to_mobile_cb; + pbm->gc = gc; + m = g_list_append(m, pbm); + } + return m; }