Skip to content

Commit

Permalink
Use P4-context.
Browse files Browse the repository at this point in the history
For groups.im.
  • Loading branch information
deadcow authored and felipec committed Jan 12, 2009
1 parent 84b5edb commit 1386c1f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions switchboard.c
Expand Up @@ -24,6 +24,7 @@
#include "session.h"
#include "switchboard.h"
#include "notification.h"
#include "fix_purple.h"

#if defined(PECAN_CVR)
#include "cvr/slplink.h"
Expand Down Expand Up @@ -998,10 +999,12 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
{
PurpleConnection *gc;
MsnSwitchBoard *swboard;
PurpleBuddy *buddy;
const char *body;
char *body_str;
char *body_enc;
char *body_final;
char *alias_backup = NULL;
size_t body_len;
const char *passport;
const char *value;
Expand All @@ -1017,6 +1020,8 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg)

passport = msg->remote_user;

buddy = purple_find_buddy(purple_connection_get_account(gc), passport);

if (!strcmp(passport, "messenger@microsoft.com") &&
strstr(body, "immediate security update"))
{
Expand All @@ -1030,6 +1035,12 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
}
#endif

if ((value = msn_message_get_attr(msg, "P4-Context")) != NULL)
{
alias_backup = g_strdup(buddy->alias);
purple_buddy_set_displayname(gc, passport, value);
}

if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL)
{
char *pre, *post;
Expand Down Expand Up @@ -1078,6 +1089,12 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
}
}

if (alias_backup)
{
purple_buddy_set_displayname(gc, passport, alias_backup);
g_free(alias_backup);
}

g_free(body_final);
}

Expand Down

0 comments on commit 1386c1f

Please sign in to comment.