summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2008-04-13 17:20:55 +0000
committerishmal <ishmal@users.sourceforge.net>2008-04-13 17:20:55 +0000
commit5c66fe094d9e68e0f4e2e3fb4052e2d43a75a55c (patch)
tree5c522ce663ead3ca16dd0c832e6de70a3730f630 /src
parentmake saslMd5Authenticate() error message a bit smarter (diff)
downloadinkscape-5c66fe094d9e68e0f4e2e3fb4052e2d43a75a55c.tar.gz
inkscape-5c66fe094d9e68e0f4e2e3fb4052e2d43a75a55c.zip
Make pedro dom list simpler
(bzr r5416)
Diffstat (limited to 'src')
-rw-r--r--src/pedro/pedrodom.cpp8
-rw-r--r--src/pedro/pedrodom.h14
-rw-r--r--src/pedro/pedroxmpp.cpp21
3 files changed, 24 insertions, 19 deletions
diff --git a/src/pedro/pedrodom.cpp b/src/pedro/pedrodom.cpp
index 4cb176a52..7a66a50d5 100644
--- a/src/pedro/pedrodom.cpp
+++ b/src/pedro/pedrodom.cpp
@@ -4,7 +4,7 @@
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005-2007 Bob Jamison
+ * Copyright (C) 2005-2008 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,7 +48,7 @@ Element *Element::clone()
elem->attributes = attributes;
elem->namespaces = namespaces;
- std::vector<Element *>::iterator iter;
+ ElementList::iterator iter;
for (iter = children.begin(); iter != children.end() ; iter++)
{
elem->addChild((*iter)->clone());
@@ -84,7 +84,7 @@ DOMString Element::getAttribute(const DOMString &name)
DOMString Element::getTagAttribute(const DOMString &tagName, const DOMString &attrName)
{
- std::vector<Element *>elems = findElements(tagName);
+ ElementList elems = findElements(tagName);
if (elems.size() <1)
return "";
DOMString res = elems[0]->getAttribute(attrName);
@@ -93,7 +93,7 @@ DOMString Element::getTagAttribute(const DOMString &tagName, const DOMString &at
DOMString Element::getTagValue(const DOMString &tagName)
{
- std::vector<Element *>elems = findElements(tagName);
+ ElementList elems = findElements(tagName);
if (elems.size() <1)
return "";
DOMString res = elems[0]->getValue();
diff --git a/src/pedro/pedrodom.h b/src/pedro/pedrodom.h
index b8078dce1..e82115ede 100644
--- a/src/pedro/pedrodom.h
+++ b/src/pedro/pedrodom.h
@@ -6,7 +6,7 @@
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005-2007 Bob Jamison
+ * Copyright (C) 2005-2008 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -127,6 +127,12 @@ protected:
};
+//#Define a list of elements. (Children, search results, etc)
+class Element;
+typedef std::vector<Element *> ElementList;
+
+
+
class Element
{
friend class Parser;
@@ -181,10 +187,10 @@ public:
Element *getFirstChild()
{ return (children.size() == 0) ? NULL : children[0]; }
- std::vector<Element *> getChildren()
+ ElementList getChildren()
{ return children; }
- std::vector<Element *> findElements(const DOMString &name);
+ ElementList findElements(const DOMString &name);
DOMString getAttribute(const DOMString &name);
@@ -237,7 +243,7 @@ protected:
Element *parent;
- std::vector<Element *>children;
+ ElementList children;
std::vector<Attribute> attributes;
std::vector<Namespace> namespaces;
diff --git a/src/pedro/pedroxmpp.cpp b/src/pedro/pedroxmpp.cpp
index 757a883da..0dd78c5b8 100644
--- a/src/pedro/pedroxmpp.cpp
+++ b/src/pedro/pedroxmpp.cpp
@@ -875,7 +875,7 @@ static bool isGroupChat(Element *root)
{
if (!root)
return false;
- std::vector<Element *>elems = root->findElements("x");
+ ElementList elems = root->findElements("x");
for (unsigned int i=0 ; i<elems.size() ; i++)
{
DOMString xmlns = elems[i]->getAttribute("xmlns");
@@ -1107,7 +1107,7 @@ bool XmppClient::processIq(Element *root)
if (root->getTagAttribute("query", "xmlns") == "jabber:iq:roster")
{
roster.clear();
- std::vector<Element *>elems = root->findElements("item");
+ ElementList elems = root->findElements("item");
for (unsigned int i=0 ; i<elems.size() ; i++)
{
Element *item = elems[i];
@@ -1131,7 +1131,7 @@ bool XmppClient::processIq(Element *root)
else if (id.find("regpass") != id.npos)
{
- std::vector<Element *> list = root->findElements("error");
+ ElementList list = root->findElements("error");
if (list.size()==0)
{
XmppEvent evt(XmppEvent::EVENT_REGISTRATION_CHANGE_PASS);
@@ -1167,7 +1167,7 @@ bool XmppClient::processIq(Element *root)
else if (id.find("regcancel") != id.npos)
{
- std::vector<Element *> list = root->findElements("error");
+ ElementList list = root->findElements("error");
if (list.size()==0)
{
XmppEvent evt(XmppEvent::EVENT_REGISTRATION_CANCEL);
@@ -1236,7 +1236,7 @@ bool XmppClient::receiveAndProcess()
}
//#### MESSAGE
- std::vector<Element *>elems = root->findElements("message");
+ ElementList elems = root->findElements("message");
if (elems.size()>0)
{
if (!processMessage(root))
@@ -1336,7 +1336,7 @@ bool XmppClient::inBandRegistrationNew()
//elem->print();
//# does the entity send the newer "instructions" tag?
- std::vector<Element *> fields = elem->findElements("field");
+ ElementList fields = elem->findElements("field");
std::vector<DOMString> fnames;
for (unsigned int i=0; i<fields.size() ; i++)
{
@@ -1380,7 +1380,7 @@ bool XmppClient::inBandRegistrationNew()
elem = parser.parse(recbuf);
//elem->print();
- std::vector<Element *> list = elem->findElements("error");
+ ElementList list = elem->findElements("error");
if (list.size()>0)
{
Element *errElem = list[0];
@@ -1732,7 +1732,7 @@ bool XmppClient::saslMd5Authenticate()
status("server says:: '%s'", recbuf.c_str());
elem = parser.parse(recbuf);
//elem->print();
- //# Early success?
+ //# Success or failure already?
if (elem->findElements("success").size() > 0)
{
delete elem;
@@ -1740,7 +1740,7 @@ bool XmppClient::saslMd5Authenticate()
}
else
{
- std::vector<Element *> list = elem->findElements("failure");
+ ElementList list = elem->findElements("failure");
if (list.size() > 0)
{
DOMString errmsg = "";
@@ -1918,8 +1918,7 @@ bool XmppClient::saslAuthenticate()
}
//check for sasl authentication mechanisms
- std::vector<Element *> elems =
- elem->findElements("mechanism");
+ ElementList elems = elem->findElements("mechanism");
if (elems.size() < 1)
{
error("login: no SASL mechanism offered by server");