add flags to db for jabber and sms notification
darcs-hash:20080623023859-84dde-1c72985ee0a840e59d1fac88f27f929f3c637b65.gz
This commit is contained in:
parent
7d9372ec50
commit
f6d219bac4
|
@ -45,8 +45,11 @@ create table user (
|
||||||
password varchar(255) comment 'salted password, can be null for OpenID users',
|
password varchar(255) comment 'salted password, can be null for OpenID users',
|
||||||
email varchar(255) unique key comment 'email address for password recovery etc.',
|
email varchar(255) unique key comment 'email address for password recovery etc.',
|
||||||
jabber varchar(255) unique key comment 'jabber ID for notices',
|
jabber varchar(255) unique key comment 'jabber ID for notices',
|
||||||
|
jabbernotify tinyint default 0 comment 'whether to send notices to jabber',
|
||||||
|
updatefrompresence tinyint default 0 comment 'whether to record updates from Jabber presence notices',
|
||||||
sms varchar(64) unique key comment 'sms phone number',
|
sms varchar(64) unique key comment 'sms phone number',
|
||||||
carrier integer comment 'foreign key to sms_carrier' references sms_carrier (id),
|
carrier integer comment 'foreign key to sms_carrier' references sms_carrier (id),
|
||||||
|
smsnotify tinyint default 0 comment 'whether to send notices to SMS',
|
||||||
uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
|
uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
|
||||||
created datetime not null comment 'date this record was created',
|
created datetime not null comment 'date this record was created',
|
||||||
modified timestamp comment 'date this record was modified'
|
modified timestamp comment 'date this record was modified'
|
||||||
|
|
|
@ -89,6 +89,22 @@ class XMPPDaemon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_notify(&$user, $notify) {
|
||||||
|
$orig = clone($user);
|
||||||
|
$user->jabbernotify = $notify;
|
||||||
|
$result = $user->update($orig);
|
||||||
|
if (!$id) {
|
||||||
|
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
|
||||||
|
$this->log(LOG_ERROR,
|
||||||
|
'Could not set notify flag to ' . $notify .
|
||||||
|
' for user ' . common_log_objstring($user) .
|
||||||
|
': ' . $last_error->message);
|
||||||
|
} else {
|
||||||
|
$this->log(LOG_INFO,
|
||||||
|
'User ' . $user->nickname . ' set notify flag to ' . $notify);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function add_notice(&$user, &$pl) {
|
function add_notice(&$user, &$pl) {
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
$notice->profile_id = $user->id;
|
$notice->profile_id = $user->id;
|
||||||
|
@ -116,6 +132,8 @@ class XMPPDaemon {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
common_broadcast_notice($notice);
|
common_broadcast_notice($notice);
|
||||||
|
$this->log(LOG_INFO,
|
||||||
|
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_presence(&$pl) {
|
function handle_presence(&$pl) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user