soc.2009.transport: 03956ff8: Enable chatstates
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Thu Jun 18 01:25:33 EDT 2009
-----------------------------------------------------------------
Revision: 03956ff89cbd6671d938c923e5e7ab204b37a57a
Ancestor: e96221a7f8006e942c520f9d236ad79c3152f99b
Author: hanzz at soc.pidgin.im
Date: 2009-06-16T11:11:11
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/03956ff89cbd6671d938c923e5e7ab204b37a57a
Modified files:
adhocsettings.cpp user.cpp
ChangeLog:
Enable chatstates
-------------- next part --------------
============================================================
--- adhocsettings.cpp ee7f59a0e4c2b19dda4452c4f84b202bfd58855a
+++ adhocsettings.cpp 37b19843f9d703aee2c53c09f479dae131aef887
@@ -83,6 +83,17 @@ AdhocSettings::AdhocSettings(GlooxMessag
field->addChild(new Tag("value","0"));
xdata->addChild(field);
+ field = new Tag("field");
+ field->addAttribute("type","boolean");
+ field->addAttribute("label","Enable chatstates");
+ field->addAttribute("var","enable_chatstate");
+ value = m_user->getSetting("enable_chatstate");
+ 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);
============================================================
--- user.cpp 79434030301d6c8a4693c118336cdc22f68ef2cb
+++ user.cpp f83573d241a936d4a618ab64a269ca12abd6d481
@@ -77,6 +77,12 @@ User::User(GlooxMessageHandler *parent,
purple_value_set_boolean(value, true);
g_hash_table_replace(m_settings, g_strdup("enable_avatars"), value);
}
+ if ( (value = getSetting("enable_chatstate")) == NULL ) {
+ p->sql()->addSetting(m_jid, "enable_chatstate", "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_chatstate"), value);
+ }
}
bool User::syncCallback() {
@@ -546,9 +552,11 @@ void User::purpleConversationWriteIM(Pur
s.setFrom(from);
// chatstates
- if (hasFeature(GLOOX_FEATURE_CHATSTATES)) {
- ChatState *c = new ChatState(ChatStateActive);
- s.addExtension(c);
+ if (purple_value_get_boolean(getSetting("enable_chatstate"))) {
+ if (hasFeature(GLOOX_FEATURE_CHATSTATES)) {
+ ChatState *c = new ChatState(ChatStateActive);
+ s.addExtension(c);
+ }
}
// Delayed messages, we have to count with some delay
@@ -617,6 +625,8 @@ void User::purpleBuddyTypingStopped(cons
void User::purpleBuddyTypingStopped(const std::string &uin){
if (!hasFeature(GLOOX_FEATURE_CHATSTATES))
return;
+ if (!purple_value_get_boolean(getSetting("enable_chatstate")))
+ return;
Log().Get(m_jid) << uin << " stopped typing";
@@ -644,6 +654,8 @@ void User::purpleBuddyTyping(const std::
void User::purpleBuddyTyping(const std::string &uin){
if (!hasFeature(GLOOX_FEATURE_CHATSTATES))
return;
+ if (!purple_value_get_boolean(getSetting("enable_chatstate")))
+ return;
Log().Get(m_jid) << uin << " is typing";
Tag *s = new Tag("message");
More information about the Commits
mailing list