soc.2009.transport: dab3a17f: Move protocol-related stuff from request...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Thu Jul 16 04:25:36 EDT 2009
-----------------------------------------------------------------
Revision: dab3a17f5615e195bef5a0a31713c7bc30747887
Ancestor: 42fb5ba3ab61c31c2516349ace31bf87591d7c1a
Author: hanzz at soc.pidgin.im
Date: 2009-07-16T07:41:53
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/dab3a17f5615e195bef5a0a31713c7bc30747887
Modified files:
main.cpp protocols/abstractprotocol.h protocols/facebook.cpp
protocols/facebook.h protocols/icq.cpp protocols/icq.h
ChangeLog:
Move protocol-related stuff from request_input to protocols classes
-------------- next part --------------
============================================================
--- main.cpp bd672fa58b48f8538800362ffd0131484996c85b
+++ main.cpp c7fe3b4353b0445bfbe59c4215afadf7debce71c
@@ -211,18 +211,7 @@ static void * requestInput(const char *t
}
}
- else {
- if (primaryString=="Authorization Request Message:") {
- Log().Get("purple") << "accepting this authorization request";
- ((PurpleRequestInputCb) ok_cb)(user_data,tr(user->getLang(),_("Please authorize me.")));
- }
- else if ( primaryString == "Set your Facebook status" ) {
- Log().Get("purple") << "set facebook status";
- if (user!=NULL){
- ((PurpleRequestInputCb) ok_cb)(user_data,user->actionData.c_str());
- }
- }
- }
+ GlooxMessageHandler::instance()->protocol()->onPurpleRequestInput(user, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb, account, who, conv, user_data);
}
return NULL;
}
============================================================
--- protocols/abstractprotocol.h 512950c30f7c96c9a2880229609edea5cef0b152
+++ protocols/abstractprotocol.h e9fc5b987ec1ed29dbabf6cb3e4c1bbe6b6cd034
@@ -104,6 +104,10 @@ class AbstractProtocol
* Presence Received. Returns true if the presence was handled.
*/
virtual bool onPresenceReceived(User *user, const Presence &stanza) { return false; }
+ /*
+ * Called on purple_request_input.
+ */
+ virtual void onPurpleRequestInput(User *user, const char *title, const char *primary,const char *secondary, const char *default_value,gboolean multiline, gboolean masked, gchar *hint,const char *ok_text, GCallback ok_cb,const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who,PurpleConversation *conv, void *user_data) { }
};
#endif
============================================================
--- protocols/facebook.cpp 29b0a4684dbd71637ad8d1ecb789a238d4373f60
+++ protocols/facebook.cpp 244b863658a0d01f8490bee4701c41ded11cca2e
@@ -169,3 +169,12 @@ Tag *FacebookProtocol::getVCardTag(User
return vcard;
}
+void FacebookProtocol::onPurpleRequestInput(User *user, const char *title, const char *primary,const char *secondary, const char *default_value,gboolean multiline, gboolean masked, gchar *hint,const char *ok_text, GCallback ok_cb,const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who,PurpleConversation *conv, void *user_data) {
+ if (primary){
+ std::string primaryString(primary);
+ if ( primaryString == "Set your Facebook status" ) {
+ ((PurpleRequestInputCb) ok_cb)(user_data,user->actionData.c_str());
+ }
+ }
+}
+
============================================================
--- protocols/facebook.h 6006a42c2e131464efd8e9cbcf0dac9f82fae808
+++ protocols/facebook.h 037ffa8b248902eb8c2faec08b897bc49811e882
@@ -45,6 +45,8 @@ class FacebookProtocol : AbstractProtoco
std::string replace(std::string &str, const char *string_to_replace, const char *new_string);
std::string userSearchColumn() { return "ID"; }
+
+ void onPurpleRequestInput(User *user, const char *title, const char *primary,const char *secondary, const char *default_value,gboolean multiline, gboolean masked, gchar *hint,const char *ok_text, GCallback ok_cb,const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who,PurpleConversation *conv, void *user_data);
private:
GlooxMessageHandler *m_main;
============================================================
--- protocols/icq.cpp 0146781a3b964a055d8f2a91672f68facdd81532
+++ protocols/icq.cpp 9cf1c5552f982fdea13fe0905e45133e5d2d2b46
@@ -172,3 +172,11 @@ Tag *ICQProtocol::getVCardTag(User *user
return vcard;
}
+void ICQProtocol::onPurpleRequestInput(User *user, const char *title, const char *primary,const char *secondary, const char *default_value,gboolean multiline, gboolean masked, gchar *hint,const char *ok_text, GCallback ok_cb,const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who,PurpleConversation *conv, void *user_data) {
+ if (primary){
+ std::string primaryString(primary);
+ if (primaryString == "Authorization Request Message:") {
+ ((PurpleRequestInputCb) ok_cb)(user_data,tr(user->getLang(),_("Please authorize me.")));
+ }
+ }
+}
============================================================
--- protocols/icq.h ca57e4291a6294fd4ad3b65025e6ca946d789a6d
+++ protocols/icq.h 56fb609569dcc14b46194fd3dca62b4be396ee89
@@ -40,6 +40,8 @@ class ICQProtocol : AbstractProtocol
Tag *getVCardTag(User *user, GList *vcardEntries);
bool isMUC(User *user, const std::string &jid) { return false; }
+ void onPurpleRequestInput(User *user, const char *title, const char *primary,const char *secondary, const char *default_value,gboolean multiline, gboolean masked, gchar *hint,const char *ok_text, GCallback ok_cb,const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who,PurpleConversation *conv, void *user_data);
+
std::string replace(std::string &str, const char *string_to_replace, const char *new_string);
private:
More information about the Commits
mailing list