better notices on commands and errors
darcs-hash:20080704201716-84dde-97709a82225bf5a972d9462f692eff1675d50ceb.gz
This commit is contained in:
parent
e45a97a20f
commit
017bbd3b0f
@ -85,8 +85,6 @@ class XMPPDaemon {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Flush DB_DataObject cache so we get fresh info
|
|
||||||
$GLOBALS['_DB_DATAOBJECT']['CACHE'] = array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +116,9 @@ class XMPPDaemon {
|
|||||||
$user = $this->get_user($from);
|
$user = $this->get_user($from);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
|
$this->from_site($from, 'Unknown user; go to ' .
|
||||||
|
common_local_url('imsettings') .
|
||||||
|
' to add your address to your account');
|
||||||
$this->log(LOG_WARNING, 'Message from unknown user ' . $from);
|
$this->log(LOG_WARNING, 'Message from unknown user ' . $from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -128,14 +129,21 @@ class XMPPDaemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function from_site($address, $msg) {
|
||||||
|
$text = '['.common_config('site', 'name') . '] ' . $msg;
|
||||||
|
jabber_send_message($address, $text);
|
||||||
|
}
|
||||||
|
|
||||||
function handle_command($user, $body) {
|
function handle_command($user, $body) {
|
||||||
# XXX: localise
|
# XXX: localise
|
||||||
switch(trim($body)) {
|
switch(trim($body)) {
|
||||||
case 'on':
|
case 'on':
|
||||||
$this->set_notify($user, true);
|
$this->set_notify($user, true);
|
||||||
|
$this->from_site($user->jabber, 'notifications on');
|
||||||
return true;
|
return true;
|
||||||
case 'off':
|
case 'off':
|
||||||
$this->set_notify($user, false);
|
$this->set_notify($user, false);
|
||||||
|
$this->from_site($user->jabber, 'notifications off');
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user