summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8459d5d)
raw | patch | inline | side by side (parent: 8459d5d)
author | ishmal <ishmal@users.sourceforge.net> | |
Wed, 24 May 2006 05:08:32 +0000 (05:08 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Wed, 24 May 2006 05:08:32 +0000 (05:08 +0000) |
src/pedro/pedrogui.cpp | patch | blob | history | |
src/pedro/pedrogui.h | patch | blob | history | |
src/pedro/pedroxmpp.cpp | patch | blob | history |
diff --git a/src/pedro/pedrogui.cpp b/src/pedro/pedrogui.cpp
index b50791e25aece3ccafd12331645c732718210b1e..d5df2f5d71fb716698f163f1628668d35da02092 100644 (file)
--- a/src/pedro/pedrogui.cpp
+++ b/src/pedro/pedrogui.cpp
Glib::ustring pass = passField.get_text();
Glib::ustring newpass = newField.get_text();
Glib::ustring confpass = confField.get_text();
- if ((pass.size() < 6 || pass.size() > 12 ) ||
- (newpass.size() < 6 || newpass.size() > 12 ) ||
- (confpass.size() < 6 || confpass.size()> 12 ))
+ if ((pass.size() < 5 || pass.size() > 12 ) ||
+ (newpass.size() < 5 || newpass.size() > 12 ) ||
+ (confpass.size() < 5 || confpass.size()> 12 ))
{
- Gtk::MessageDialog dlg(*this, "Password must be 6 to 12 characters",
+ Gtk::MessageDialog dlg(*this, "Password must be 5 to 12 characters",
false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.run();
}
}
else
{
- response(Gtk::RESPONSE_OK);
+ //response(Gtk::RESPONSE_OK);
hide();
}
}
void PasswordDialog::cancelCallback()
{
- response(Gtk::RESPONSE_CANCEL);
+ //response(Gtk::RESPONSE_CANCEL);
hide();
}
+void PasswordDialog::on_response(int response_id)
+{
+ if (response_id == Gtk::RESPONSE_OK)
+ okCallback();
+ else
+ cancelCallback();
+}
bool PasswordDialog::doSetup()
{
table.attach(confField, 1, 2, 2, 3);
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
+ add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
show_all_children();
//################################
//# EVENTS
//################################
+
+/**
+ *
+ */
+void PedroGui::handleConnectEvent()
+{
+ status("##### CONNECTED");
+ actionEnable("Connect", false);
+ actionEnable("Chat", true);
+ actionEnable("GroupChat", true);
+ actionEnable("Disconnect", true);
+ actionEnable("RegPass", true);
+ actionEnable("RegCancel", true);
+ DOMString title = "Pedro - ";
+ title.append(client.getJid());
+ set_title(title);
+}
+
+
+/**
+ *
+ */
+void PedroGui::handleDisconnectEvent()
+{
+ status("##### DISCONNECTED");
+ actionEnable("Connect", true);
+ actionEnable("Chat", false);
+ actionEnable("GroupChat", false);
+ actionEnable("Disconnect", false);
+ actionEnable("RegPass", false);
+ actionEnable("RegCancel", false);
+ DOMString title = "Pedro";
+ set_title(title);
+ chatDeleteAll();
+ groupChatDeleteAll();
+}
+
+
/**
*
*/
}
case XmppEvent::EVENT_CONNECTED:
{
- status("##### CONNECTED");
- actionEnable("Connect", false);
- actionEnable("Chat", true);
- actionEnable("GroupChat", true);
- actionEnable("Disconnect", true);
- actionEnable("RegPass", true);
- actionEnable("RegCancel", true);
- DOMString title = "Pedro - ";
- title.append(client.getJid());
- set_title(title);
+ handleConnectEvent();
break;
}
case XmppEvent::EVENT_DISCONNECTED:
{
- status("##### DISCONNECTED");
- actionEnable("Connect", true);
- actionEnable("Chat", false);
- actionEnable("GroupChat", false);
- actionEnable("Disconnect", false);
- actionEnable("RegPass", false);
- actionEnable("RegCancel", false);
- DOMString title = "Pedro";
- set_title(title);
- chatDeleteAll();
- groupChatDeleteAll();
+ handleDisconnectEvent();
break;
}
case XmppEvent::EVENT_MESSAGE:
event.getTo().c_str(), event.getFrom().c_str());
break;
}
+ case XmppEvent::EVENT_REGISTRATION_CHANGE_PASS:
+ {
+ status("##### PASSWORD CHANGED: %s at %s\n",
+ event.getTo().c_str(), event.getFrom().c_str());
+ break;
+ }
+ case XmppEvent::EVENT_REGISTRATION_CANCEL:
+ {
+ //client.disconnect();
+ status("##### REGISTERATION CANCELLED: %s at %s\n",
+ event.getTo().c_str(), event.getFrom().c_str());
+ break;
+ }
default:
{
printf("unknown event type: %d\n", typ);
Gtk::MessageDialog dlg(*this, "Do you want to cancel your registration on the server?",
false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true);
int ret = dlg.run();
- if (ret == Gtk::RESPONSE_OK)
+ if (ret == Gtk::RESPONSE_YES)
{
client.inBandRegistrationCancel();
}
diff --git a/src/pedro/pedrogui.h b/src/pedro/pedrogui.h
index bee20c2947f04124e7d95e6775a1f1533d4baf94..a600e6d5011f3ae8e890dac8d50f74c7b81b913d 100644 (file)
--- a/src/pedro/pedrogui.h
+++ b/src/pedro/pedrogui.h
DOMString getConfirm()
{ return confField.get_text(); }
+protected:
+
+ //Overloaded from Gtk::Dialog
+ virtual void on_response(int response_id);
+
private:
void okCallback();
virtual ~PedroGui();
+ //Let everyone share this
+ XmppClient client;
+
+
virtual void error(const char *fmt, ...);
virtual void status(const char *fmt, ...);
- //Let everyone share this
- XmppClient client;
+ void handleConnectEvent();
+
+ void handleDisconnectEvent();
+
/**
*
*/
/**
*
*/
- bool PedroGui::checkEventQueue();
+ bool checkEventQueue();
bool chatCreate(const DOMString &userJid);
long size,
const DOMString &hash);
-private:
-
//# File menu
void connectCallback();
//# Help menu
void aboutCallback();
+private:
+
bool doSetup();
Gtk::VBox mainBox;
index 7160a09bd59d4ff09ed131b26d393b88e510ce95..92fa2f9a1a79e923adfa968bd01dd667c08f9f18 100644 (file)
--- a/src/pedro/pedroxmpp.cpp
+++ b/src/pedro/pedroxmpp.cpp
@@ -3405,7 +3405,7 @@ bool XmppClient::inBandRegistrationChangePassword(const DOMString &newpassword)
//# Let's try it form-style to allow the common old/new password thing
char *fmt =
- "<iq type='set' from='%s' to='%s' id='regpass%d'>"
+ "<iq type='set' id='regpass%d' from='%s' to='%s'>"
" <query xmlns='jabber:iq:register'>"
" <x xmlns='jabber:x:data' type='form'>"
" <field type='hidden' var='FORM_TYPE'>"
Parser parser;
char *fmt =
- "<iq type='set' from='%s' id='regcancel%d'>"
+ "<iq type='set' id='regcancel%d' from='%s'>"
"<query xmlns='jabber:iq:register'><remove/></query>"
"</iq>\n\n";
if (!write(fmt, msgId++, jid.c_str()))