Show proper aliases even for MSN
This commit is contained in:
parent
2836f390b9
commit
d6766b4f84
4 changed files with 22 additions and 6 deletions
|
@ -126,10 +126,16 @@ static void *requestAction(const char *title, const char *primary, const char *s
|
|||
|
||||
static std::string getAlias(PurpleBuddy *m_buddy) {
|
||||
std::string alias;
|
||||
if (purple_buddy_get_server_alias(m_buddy))
|
||||
alias = (std::string) purple_buddy_get_server_alias(m_buddy);
|
||||
else
|
||||
PurpleContact *contact = PURPLE_CONTACT(PURPLE_BLIST_NODE(m_buddy)->parent);
|
||||
if (contact && contact->alias) {
|
||||
alias = contact->alias;
|
||||
}
|
||||
else if (purple_buddy_get_alias(m_buddy)) {
|
||||
alias = (std::string) purple_buddy_get_alias(m_buddy);
|
||||
}
|
||||
else {
|
||||
alias = (std::string) purple_buddy_get_server_alias(m_buddy);
|
||||
}
|
||||
return alias;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class LocalBuddy : public Buddy {
|
|||
virtual ~LocalBuddy();
|
||||
|
||||
std::string getAlias() { return m_alias; }
|
||||
void setAlias(const std::string &alias) { m_alias = alias; }
|
||||
void setAlias(const std::string &alias);
|
||||
|
||||
std::string getName() { return m_name; }
|
||||
void setName(const std::string &name) { m_name = name; }
|
||||
|
|
|
@ -82,14 +82,14 @@ class RosterManager {
|
|||
|
||||
void handleSubscription(Swift::Presence::ref presence);
|
||||
|
||||
void sendBuddyRosterPush(Buddy *buddy);
|
||||
|
||||
private:
|
||||
void setBuddyCallback(Buddy *buddy);
|
||||
|
||||
void sendBuddyRosterPush(Buddy *buddy);
|
||||
void sendRIE();
|
||||
void handleBuddyRosterPushResponse(Swift::ErrorPayload::ref error, const std::string &key);
|
||||
|
||||
|
||||
std::map<std::string, Buddy *> m_buddies;
|
||||
Component *m_component;
|
||||
RosterStorage *m_rosterStorage;
|
||||
|
|
|
@ -30,4 +30,14 @@ LocalBuddy::LocalBuddy(RosterManager *rosterManager, long id) : Buddy(rosterMana
|
|||
LocalBuddy::~LocalBuddy() {
|
||||
}
|
||||
|
||||
void LocalBuddy::setAlias(const std::string &alias) {
|
||||
bool changed = m_alias != alias;
|
||||
m_alias = alias;
|
||||
|
||||
if (changed) {
|
||||
getRosterManager()->sendBuddyRosterPush(this);
|
||||
getRosterManager()->storeBuddy(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue