summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab4a446)
raw | patch | inline | side by side (parent: ab4a446)
author | ishmal <ishmal@users.sourceforge.net> | |
Mon, 22 May 2006 06:05:04 +0000 (06:05 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Mon, 22 May 2006 06:05:04 +0000 (06:05 +0000) |
src/pedro/pedrogui.cpp | patch | blob | history | |
src/pedro/pedroxmpp.cpp | patch | blob | history |
diff --git a/src/pedro/pedrogui.cpp b/src/pedro/pedrogui.cpp
index 48dfa94e91c9401ab0452bf9d0fbf103c5a53491..0ef33b5c21c80201e90c4e3ed6b691b20220ad2f 100644 (file)
--- a/src/pedro/pedrogui.cpp
+++ b/src/pedro/pedrogui.cpp
table.resize(6, 2);
get_vbox()->pack_start(table);
- parent.client.setHost("broadway.dynalias.com");
+ parent.client.setHost("gristle.org");
parent.client.setPort(5223);
parent.client.setUsername("");
parent.client.setPassword("");
event.getFileSize(), event.getFileHash());
break;
}
+ case XmppEvent::EVENT_REGISTRATION_NEW:
+ {
+ status("##### REGISTERED: %s at %s\n",
+ event.getTo().c_str(), event.getFrom().c_str());
+ break;
+ }
default:
{
printf("unknown event type: %d\n", typ);
index 6bce6c10eb4318fb7334d510f55ebd00fb295ff9..0951c6767e42343b69f79bbafa98c56332be251b 100644 (file)
--- a/src/pedro/pedroxmpp.cpp
+++ b/src/pedro/pedroxmpp.cpp
}
DOMString realm = attrs["realm"];
- if (nonce.size()==0)
+ if (realm.size()==0)
{
error("login: no SASL realm sent by server");
return false;
status("SASL recv nonce: '%s' realm:'%s'\n", nonce.c_str(), realm.c_str());
- char idBuf[7];
- snprintf(idBuf, 6, "%dsasl", msgId++);
+ char idBuf[10];
+ snprintf(idBuf, 9, "%dsasl", msgId++);
DOMString cnonce = Sha1::hashHex((unsigned char *)idBuf, 7);
DOMString authzid = username; authzid.append("@"); authzid.append(host);
DOMString digest_uri = "xmpp/"; digest_uri.append(host);
md5.append(nonce);
md5.append(":");
md5.append(cnonce);
- md5.append(":");
- md5.append(authzid);
+ //RFC2831 says authzid is optional. Wildfire has trouble with authzid's
+ //md5.append(":");
+ //md5.append(authzid);
+ md5.append("");
DOMString a1 = md5.finishHex();
status("##a1:'%s'", a1.c_str());
resp.append("cnonce=\""); resp.append(cnonce); resp.append("\",");
resp.append("nc=00000001,qop=auth,");
resp.append("digest-uri=\""); resp.append(digest_uri); resp.append("\"," );
- resp.append("authzid=\""); resp.append(authzid); resp.append("\",");
- resp.append("response=\""); resp.append(response); resp.append("\",");
+ //resp.append("authzid=\""); resp.append(authzid); resp.append("\",");
+ resp.append("response="); resp.append(response); resp.append(",");
resp.append("charset=utf-8");
status("sending response:'%s'", resp.c_str());
resp = Base64Encoder::encode(resp);
DOMString recbuf = readStanza();
status("RECV reg: %s", recbuf.c_str());
Element *elem = parser.parse(recbuf);
- elem->print();
+ //elem->print();
//# does the entity send the "instructions" tag?
- bool hasInstructions =
- (elem->findElements("instructions").size() > 0);
+ std::vector<Element *> fields = elem->findElements("field");
+ std::vector<DOMString> fnames;
+ for (unsigned int i=0; i<fields.size() ; i++)
+ {
+ DOMString fname = fields[i]->getAttribute("var");
+ if (fname == "FORM_TYPE")
+ continue;
+ fnames.push_back(fname);
+ status("field name:%s", fname.c_str());
+ }
+
delete elem;
- if (!hasInstructions)
+ if (fnames.size() == 0)
{
error("server did not offer registration");
return false;
}
+
fmt =
"<iq type='set' id='reg2'>"
"<query xmlns='jabber:iq:register'>"
"<username>%s</username>"
"<password>%s</password>"
+ "<email/><name/>"
"</query>"
"</iq>\n\n";
- if (!write(fmt, toXml(username).c_str(), toXml(password).c_str() ))
+ if (!write(fmt, toXml(username).c_str(),
+ toXml(password).c_str() ))
return false;
recbuf = readStanza();
status("RECV reg: %s", recbuf.c_str());
elem = parser.parse(recbuf);
- elem->print();
+ //elem->print();
std::vector<Element *> list = elem->findElements("error");
if (list.size()>0)
delete elem;
XmppEvent evt(XmppEvent::EVENT_REGISTRATION_NEW);
+ evt.setTo(username);
+ evt.setFrom(host);
dispatchXmppEvent(evt);
return true;