soc.2009.transport: 346bc59b: Resend email notification only if it's a...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Mon Jun 15 05:01:29 EDT 2009
-----------------------------------------------------------------
Revision: 346bc59b5b65740cd014788fd6ef1f797ca0458e
Ancestor: 48fd97bf756120abeb60abd506ab732b1fa43fd3
Author: hanzz at soc.pidgin.im
Date: 2009-06-15T08:58:17
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/346bc59b5b65740cd014788fd6ef1f797ca0458e
Modified files:
adhocsettings.cpp main.cpp user.cpp
ChangeLog:
Resend email notification only if it's allowed in settings
-------------- next part --------------
============================================================
--- adhocsettings.cpp b9fb134394d4b7261f43d37a3081657a8c561f68
+++ adhocsettings.cpp e180005b2d84171f013e03e2368eda311019f5c4
@@ -27,6 +27,7 @@ AdhocSettings::AdhocSettings(GlooxMessag
main = m;
m_user = user;
PurpleValue *value;
+ Tag *field;
IQ _response(IQ::Result, from, id);
Tag *response = _response.tag();
@@ -49,7 +50,7 @@ AdhocSettings::AdhocSettings(GlooxMessag
xdata->addChild(new Tag("title","Transport settings"));
xdata->addChild(new Tag("instructions","Change your transport settings here."));
- Tag *field = new Tag("field");
+ field = new Tag("field");
field->addAttribute("type","boolean");
field->addAttribute("label","Enable transport");
field->addAttribute("var","enable_transport");
@@ -58,9 +59,19 @@ AdhocSettings::AdhocSettings(GlooxMessag
field->addChild(new Tag("value","1"));
else
field->addChild(new Tag("value","0"));
-
xdata->addChild(field);
+ field = new Tag("field");
+ field->addAttribute("type","boolean");
+ field->addAttribute("label","Enable network notification");
+ field->addAttribute("var","enable_notify_email");
+ value = m_user->getSetting("enable_notify_email");
+ if (purple_value_get_boolean(value))
+ field->addChild(new Tag("value","1"));
+ else
+ field->addChild(new Tag("value","0"));
+ xdata->addChild(field);
+
c->addChild(xdata);
response->addChild(c);
main->j->send(response);
============================================================
--- main.cpp 98168ba4748690fcafc45547e2886a676e045341
+++ main.cpp 7bc5f58633cf7d51566eea1aaf55d042a3148b26
@@ -952,18 +952,20 @@ void GlooxMessageHandler::notifyEmail(Pu
PurpleAccount *account = purple_connection_get_account(gc);
User *user = userManager()->getUserByAccount(account);
if (user!=NULL) {
- std::string text;
- if (subject)
- text+=std::string(subject) + " ";
- if (from)
- text+=std::string(from) + " ";
- if (to)
- text+=std::string(to) + " ";
- if (url)
- text+=std::string(url) + " ";
- Message s(Message::Chat, user->jid(), text);
- s.setFrom(protocol()->notifyUsername()+"@"+jid()+"/bot");
- j->send(s);
+ if (purple_value_get_boolean(user->getSetting("enable_notify_email"))) {
+ std::string text;
+ if (subject)
+ text+=std::string(subject) + " ";
+ if (from)
+ text+=std::string(from) + " ";
+ if (to)
+ text+=std::string(to) + " ";
+ if (url)
+ text+=std::string(url) + " ";
+ Message s(Message::Chat, user->jid(), text);
+ s.setFrom(protocol()->notifyUsername()+"@"+jid()+"/bot");
+ j->send(s);
+ }
}
}
============================================================
--- user.cpp 30cb6314ed61b45aba5d4ae272caf8fa2914bcea
+++ user.cpp edb4c76e12644bc91ba8ceef42c7aa5a63937a7d
@@ -65,7 +65,12 @@ User::User(GlooxMessageHandler *parent,
purple_value_set_boolean(value, true);
g_hash_table_replace(m_settings, g_strdup("enable_transport"), value);
}
-
+ if ( (value = getSetting("enable_notify_email")) == NULL ) {
+ p->sql()->addSetting(m_jid, "enable_notify_email", "1", PURPLE_TYPE_BOOLEAN);
+ value = purple_value_new(PURPLE_TYPE_BOOLEAN);
+ purple_value_set_boolean(value, true);
+ g_hash_table_replace(m_settings, g_strdup("enable_transport"), value);
+ }
}
bool User::syncCallback() {
More information about the Commits
mailing list