+ common_log_db_error($confirm, 'INSERT', __FILE__);
+ common_server_error(_t('Couldnt insert confirmation code.'));
+ return;
+ }
+
+ # XXX: optionally queue for offline sending
+
+ if (!jabber_is_subscribed($jabber)) {
+ jabber_special_presence('subscribe', $jabber);
+ } else {
+ jabber_confirm_address($confirm->code,
+ $user->nickname,
+ $jabber);
+ }
+
+ $this->show_form(_t('A confirmation code was ' .
+ ' sent to the IM address you added. ' .
+ ' You must approve ' . jabber_daemon_address() .
+ ' for sending messages to you.'),
+ TRUE);
+ }
+
+ function cancel_confirmation() {
+ $jabber = $this->arg('jabber');
+ $confirm = $this->get_confirmation();
+ if (!$confirm) {
+ $this->show_form(_t('No pending confirmation to cancel.'));
+ return;
+ }
+ if ($confirm->address != $jabber) {
+ $this->show_form(_t('That is the wrong IM address.'));
+ return;
+ }
+
+ $result = $confirm->delete();
+
+ if (!$result) {
+ common_log_db_error($confirm, 'DELETE', __FILE__);
+ $this->server_error(_t('Couldn\'t delete email confirmation.'));
+ return;
+ }
+
+ $this->show_form(_t('Confirmation cancelled.'), TRUE);
+ }
+
+ function remove_address() {
+
+ $user = common_current_user();
+ $jabber = $this->arg('jabber');
+
+ # Maybe an old tab open...?
+
+ if ($user->jabber != $jabber) {
+ $this->show_form(_t('That is not your Jabber ID.'));
+ return;
+ }
+
+ $user->query('BEGIN');
+ $original = clone($user);
+ $user->jabber = NULL;
+ $result = $user->updateKeys($original);
+ if (!$result) {