Set message type to 'chat' when building from a list of parameters. Added some namespaces to global list.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2986 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2009-12-14 16:44:34 +00:00
parent 30ce98def2
commit f747a6b6e1
3 changed files with 17 additions and 7 deletions

View File

@ -2228,10 +2228,10 @@ void JBEntityCapsList::addCaps(NamedList& list, JBEntityCaps& caps)
jingleVersion = 1;
else if (caps.m_features.get(XMPPNamespace::JingleSession))
jingleVersion = 0;
NamedString* params = new NamedString("caps.params");
list.addParam("caps.id",caps.toString());
list.addParam(params);
if (jingleVersion != -1) {
list.addParam("caps.id",caps.toString());
NamedString* params = new NamedString("caps.params");
list.addParam(params);
params->append("caps.jingle_version");
list.addParam("caps.jingle_version",String(jingleVersion));
switch (jingleVersion) {
@ -2245,6 +2245,7 @@ void JBEntityCapsList::addCaps(NamedList& list, JBEntityCaps& caps)
break;
}
}
CHECK_NS(XMPPNamespace::Muc,"caps.muc");
#undef CHECK_NS
}

View File

@ -225,6 +225,10 @@ const String XMPPNamespace::s_array[Count] = {
"http://jabber.org/protocol/command", // Command
"msgoffline", // MsgOffline
"jabber:component:accept", // ComponentAccept
"http://jabber.org/protocol/muc", // Muc
"http://jabber.org/protocol/muc#admin", // MucAdmin
"http://jabber.org/protocol/muc#owner", // MucOwner
"http://jabber.org/protocol/muc#user", // MucUser
};
const String XMPPError::s_array[Count] = {
@ -1550,7 +1554,9 @@ XmlElement* XMPPUtils::getChatXml(NamedList& list, const char* param,
XmlElement* xml = getXml(list,param,extra);
if (xml || !build)
return xml;
xml = createMessage(msgType(list.getValue("type")),0,0,list.getValue("id"),0);
String* type = list.getParam("type");
MsgType t = TelEngine::null(type) ? Chat : msgType(*type);
xml = createMessage(t,0,0,list.getValue("id"),0);
const char* subject = list.getValue("subject");
if (!TelEngine::null(subject))
xml->addChild(createSubject(subject));

View File

@ -215,7 +215,11 @@ public:
Command= 45, // http://jabber.org/protocol/command
MsgOffline= 46, // msgoffline
ComponentAccept = 47, // jabber:component:accept
Count = 48,
Muc = 48, // http://jabber.org/protocol/muc
MucAdmin = 49, // http://jabber.org/protocol/muc#admin
MucOwner = 50, // http://jabber.org/protocol/muc#owner
MucUser = 51, // http://jabber.org/protocol/muc#user
Count = 52,
};
/**
@ -1018,7 +1022,6 @@ public:
HeadLine, // headline
Normal, // normal
MsgError, // error
MsgNone
};
/**
@ -1850,7 +1853,7 @@ public:
* @return Message type as enumeration
*/
static inline MsgType msgType(const char* text)
{ return (MsgType)lookup(text,s_msg,TelEngine::null(text) ? Chat : MsgNone); }
{ return (MsgType)lookup(text,s_msg,Normal); }
/**
* Get the text from a message type