summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2935854)
raw | patch | inline | side by side (parent: 2935854)
author | ishmal <ishmal@users.sourceforge.net> | |
Sun, 13 Apr 2008 17:20:55 +0000 (17:20 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sun, 13 Apr 2008 17:20:55 +0000 (17:20 +0000) |
src/pedro/pedrodom.cpp | patch | blob | history | |
src/pedro/pedrodom.h | patch | blob | history | |
src/pedro/pedroxmpp.cpp | patch | blob | history |
diff --git a/src/pedro/pedrodom.cpp b/src/pedro/pedrodom.cpp
index 4cb176a52973f72fb3dd3b7bde320ae4bceaa7ad..7a66a50d5f3804e68eb6d7283273029f54e059f7 100644 (file)
--- a/src/pedro/pedrodom.cpp
+++ b/src/pedro/pedrodom.cpp
* 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
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());
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);
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 b8078dce14fa46abb9e3d29c7dd1bfbf19a9334c..e82115ede0d781c540b7a78e8cdf6022b482f7fa 100644 (file)
--- a/src/pedro/pedrodom.h
+++ b/src/pedro/pedrodom.h
* 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
};
+//#Define a list of elements. (Children, search results, etc)
+class Element;
+typedef std::vector<Element *> ElementList;
+
+
+
class Element
{
friend class Parser;
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);
Element *parent;
- std::vector<Element *>children;
+ ElementList children;
std::vector<Attribute> attributes;
std::vector<Namespace> namespaces;
index 757a883daa84305ee59ffbc382126d47becb5407..0dd78c5b89ffb4a512e33fc892787d19fdbd04d3 100644 (file)
--- a/src/pedro/pedroxmpp.cpp
+++ b/src/pedro/pedroxmpp.cpp
{
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");
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];
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);
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);
}
//#### MESSAGE
- std::vector<Element *>elems = root->findElements("message");
+ ElementList elems = root->findElements("message");
if (elems.size()>0)
{
if (!processMessage(root))
//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++)
{
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];
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;
}
else
{
- std::vector<Element *> list = elem->findElements("failure");
+ ElementList list = elem->findElements("failure");
if (list.size() > 0)
{
DOMString errmsg = "";
}
//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");