Mercurial > pidgin.yaz
diff src/protocols/sametime/sametime.c @ 12813:547c199072c8
[gaim-migrate @ 15161]
- fixes to sametime administrative notification message dialog to make them
a little less obscure as to what the heck they are
- added an extra step to the sametime connection login between authenticating
and starting services
- fix to outgoing encoding of html formatted messages in sametime to use NCR
encoding
- addition of gaim_utf8_ncr_encode to util.h
- fix of minor possible (unlikely) memleak in gaim_utf8_ncr_decode
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Wed, 11 Jan 2006 03:07:01 +0000 |
parents | 258871a62600 |
children | aacda65b3449 |
line wrap: on
line diff
--- a/src/protocols/sametime/sametime.c Wed Jan 11 01:13:20 2006 +0000 +++ b/src/protocols/sametime/sametime.c Wed Jan 11 03:07:01 2006 +0000 @@ -66,7 +66,7 @@ #include <mw_srvc_store.h> #include <mw_st_list.h> -/* project includes */ +/* plugin includes */ #include "sametime.h" @@ -91,7 +91,7 @@ /* stages of connecting-ness */ -#define MW_CONNECT_STEPS 9 +#define MW_CONNECT_STEPS 10 /* stages of conciousness */ @@ -1301,16 +1301,6 @@ /* grab the buddy list from the server */ unit = mwStorageUnit_new(mwStore_AWARE_LIST); mwServiceStorage_load(pd->srvc_store, unit, fetch_blist_cb, pd, NULL); - - /* start watching for new conversations */ - gaim_signal_connect(gaim_conversations_get_handle(), - "conversation-created", gc, - GAIM_CALLBACK(conversation_created_cb), pd); - - /* watch for group extended menu items */ - gaim_signal_connect(gaim_blist_get_handle(), - "blist-node-extended-menu", gc, - GAIM_CALLBACK(blist_node_menu_cb), pd); /* find all the NAB groups and subscribe to them */ blist = gaim_get_blist(); @@ -1378,9 +1368,20 @@ GaimStatus *status; GaimAccount *acct; + /* set out initial status */ acct = gaim_connection_get_account(pd->gc); status = gaim_account_get_active_status(acct); mw_prpl_set_status(acct, status); + + /* start watching for new conversations */ + gaim_signal_connect(gaim_conversations_get_handle(), + "conversation-created", pd->gc, + GAIM_CALLBACK(conversation_created_cb), pd); + + /* watch for group extended menu items */ + gaim_signal_connect(gaim_blist_get_handle(), + "blist-node-extended-menu", pd->gc, + GAIM_CALLBACK(blist_node_menu_cb), pd); /* use our services to do neat things */ services_starting(pd); @@ -1434,11 +1435,14 @@ break; case mwSession_STARTED: - msg = _("Connected to Sametime Community Server"); + msg = _("Starting Services"); gaim_connection_update_progress(gc, msg, 9, MW_CONNECT_STEPS); - gaim_connection_set_state(gc, GAIM_CONNECTED); session_started(pd); + + msg = _("Connected"); + gaim_connection_update_progress(gc, msg, 10, MW_CONNECT_STEPS); + gaim_connection_set_state(gc, GAIM_CONNECTED); break; case mwSession_STOPPING: @@ -1520,16 +1524,28 @@ static void mw_session_admin(struct mwSession *session, const char *text) { - - GaimConnection *gc = session_to_gc(session); + GaimConnection *gc; + GaimAccount *acct; + const char *host; + char *prim; + + gc = session_to_gc(session); g_return_if_fail(gc != NULL); - /** @todo Admin alerts should probably be in a conversation window - rather than a gaim_notify_message. Or in some sort of updating - dialog, or something. */ - - gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, _("Admin Alert"), - text, NULL, NULL, NULL); + acct = gaim_connection_get_account(gc); + g_return_if_fail(acct != NULL); + + host = gaim_account_get_string(acct, MW_KEY_HOST, NULL); + + prim = _("A Sametime administrator has issued the following announcement" + " on server %s"); + prim = g_strdup_printf(prim, NSTR(host)); + + gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, + _("Sametime Administrator Announcement"), + prim, text, NULL, NULL); + + g_free(prim); } @@ -3711,12 +3727,13 @@ } +#if NB_HACK static char *nb_im_encode(GaimConnection *gc, const char *message) { GaimAccount *acct; const char *enc; char *ret; GError *error = NULL; - + acct = gaim_connection_get_account(gc); g_return_val_if_fail(acct != NULL, NULL); @@ -3739,8 +3756,10 @@ return ret; } - - +#endif + + +#if NB_HACK static gboolean is_nb(struct mwConversation *conv) { struct mwLoginInfo *info; @@ -3755,6 +3774,7 @@ really did. Oh well. CURSE YOU NOTESBUDDY */ return ((info->type == 0x1000) || ((info->type & 0xff00) == 0x1400)); } +#endif /** turn an IM with embedded images into a multi-part mime document */ @@ -3847,6 +3867,7 @@ part = gaim_mime_part_new(doc); gaim_mime_part_set_field(part, "Content-Disposition", "inline"); +#if NB_HACK if(is_nb(conv)) { GaimAccount *acct = gaim_connection_get_account(gc); @@ -3868,6 +3889,14 @@ gaim_mime_part_set_data(part, str->str); } +#else + tmp = gaim_utf8_ncr_encode(str->str); + gaim_mime_part_set_field(part, "Content-Type", "text/html"); + gaim_mime_part_set_field(part, "Content-Transfer-Encoding", "7bit"); + gaim_mime_part_set_data(part, str->str); + g_free(tmp); +#endif + g_string_free(str, TRUE); str = g_string_new(NULL); @@ -3921,6 +3950,7 @@ } else if(mwConversation_supports(conv, mwImSend_HTML)) { /* send an HTML message */ +#if NB_HACK if(is_nb(conv)) { /* html messages need the notesbuddy hack */ @@ -3933,6 +3963,13 @@ tmp = gaim_strdup_withhtml(message); } +#else + char *ncr; + ncr = gaim_utf8_ncr_encode(message); + tmp = gaim_strdup_withhtml(ncr); + g_free(ncr); +#endif + ret = mwConversation_send(conv, mwImSend_HTML, tmp); g_free(tmp); @@ -5604,11 +5641,13 @@ MW_PLUGIN_DEFAULT_PORT); l = g_list_append(l, opt); +#if NB_HACK /* notesbuddy hack encoding */ opt = gaim_account_option_string_new(_("NotesBuddy encoding"), MW_KEY_ENCODING, MW_PLUGIN_DEFAULT_ENCODING); l = g_list_append(l, opt); +#endif { /* copy the old force login setting from prefs if it's there. Don't delete the preference, since there may be more