From 893122fe8cdd47618235fde5247d95dbfed24a20 Mon Sep 17 00:00:00 2001 From: marian Date: Wed, 29 Sep 2010 08:21:57 +0000 Subject: [PATCH] Set and handle single 'group' parameters (roster item group) in user.roster messages. git-svn-id: http://yate.null.ro/svn/yate/trunk@3674 acf43c95-373e-0410-b603-e72c3f656dc1 --- modules/client/jabberclient.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/client/jabberclient.cpp b/modules/client/jabberclient.cpp index 2acbe1d1..699d0fb9 100644 --- a/modules/client/jabberclient.cpp +++ b/modules/client/jabberclient.cpp @@ -838,6 +838,14 @@ bool YJBEngine::handleUserRoster(Message& msg, const String& line) item->addChild(XMPPUtils::createElement(XmlTag::Group,o->get()->toString())); TelEngine::destruct(list); } + else { + unsigned int n = msg.length(); + for (unsigned int i = 0; i < n; i++) { + NamedString* ns = msg.getParam(i); + if (ns && ns->name() == "group" && *ns) + item->addChild(XMPPUtils::createElement(XmlTag::Group,*ns)); + } + } // Arbitrary children String* tmp = msg.getParam("extra"); if (tmp) { @@ -1622,8 +1630,11 @@ static void addRosterItem(NamedList& list, XmlElement& x, const String& id, // Groups and other children const String* ns = &XMPPUtils::s_ns[XMPPNamespace::Roster]; for (XmlElement* c = x.findFirstChild(0,ns); c; c = x.findNextChild(c,0,ns)) { - if (XMPPUtils::isUnprefTag(*c,XmlTag::Group)) - groups->append(c->getText(),","); + if (XMPPUtils::isUnprefTag(*c,XmlTag::Group)) { + const String& grp = c->getText(); + groups->append(grp,","); + list.addParam(pref + "group",grp,false); + } else list.addParam(pref + c->unprefixedTag(),c->getText()); }