* @see SettingsAction
*/
-class ImsettingsAction extends ConnectSettingsAction
+class ImsettingsAction extends SettingsAction
{
/**
* Title of the page
*
* @return string Title of the page
*/
-
function title()
{
- // TRANS: Title for instance messaging settings.
+ // TRANS: Title for Instant Messaging settings.
return _('IM settings');
}
*
* @return instructions for use
*/
-
function getInstructions()
{
// TRANS: Instant messaging settings page instructions.
*
* @return void
*/
-
function showContent()
{
$transports = array();
if ($user_im_prefs = User_im_prefs::pkeyGet( array('transport' => $transport, 'user_id' => $user->id) )) {
$user_im_prefs_by_transport[$transport] = $user_im_prefs;
$this->element('p', 'form_confirmed', $user_im_prefs->screenname);
- // TRANS: Form note in IM settings form.
$this->element('p', 'form_note',
+ // TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
sprintf(_('Current confirmed %s address.'),$transport_info['display']));
$this->hidden('screenname', $user_im_prefs->screenname);
// TRANS: Button label to remove a confirmed IM address.
// TRANS: Form note in IM settings form.
$this->element('p', 'form_note',
// TRANS: Form note in IM settings form.
- // TRANS: %s is the IM address set for the site.
+ // TRANS: %s is the IM service name, %2$s is the IM address set.
sprintf(_('Awaiting confirmation on this address. '.
- 'Check your %s account for a '.
+ 'Check your %1$s account for a '.
'message with further instructions. '.
- '(Did you add %s to your buddy list?)'),
+ '(Did you add %2$s to your buddy list?)'),
$transport_info['display'],
- $transport_info['daemon_screenname'],
- jabber_daemon_address()));
+ $transport_info['daemonScreenname']));
$this->hidden('screenname', $confirm->address);
// TRANS: Button label to cancel an IM address confirmation procedure.
$this->submit('cancel', _m('BUTTON','Cancel'));
} else {
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
+ // TRANS: Field label for IM address.
$this->input('screenname', _('IM address'),
($this->arg('screenname')) ? $this->arg('screenname') : null,
+ // TRANS: Field title for IM address. %s is the IM service name.
sprintf(_('%s screenname.'),
$transport_info['display']));
$this->elementEnd('li');
'action' =>
common_local_url('imsettings')));
$this->elementStart('fieldset', array('id' => 'settings_im_preferences'));
- $this->element('legend', null, _('Preferences'));
+ // TRANS: Header for IM preferences form.
+ $this->element('legend', null, _('IM Preferences'));
$this->hidden('token', common_session_token());
$this->elementStart('table');
$this->elementStart('tr');
- // TRANS: Header for IM preferences form.
- $this->element('th', null, _('IM Preferences'));
foreach($user_im_prefs_by_transport as $transport=>$user_im_prefs)
{
$this->element('th', null, $transports[$transport]['display']);
*
* @return Confirm_address address object for this user
*/
-
function getConfirmation($transport)
{
$user = common_current_user();
*
* @return void
*/
-
function handlePost()
{
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '.
'Try again, please.'));
return;
} else if ($this->arg('remove')) {
$this->removeAddress();
} else {
- // TRANS: Message given submitting a form with an unknown action in IM settings.
+ // TRANS: Message given submitting a form with an unknown action in Instant Messaging settings.
$this->showForm(_('Unexpected form submission.'));
}
}
*
* @return void
*/
-
function savePreferences()
{
$user = common_current_user();
$user_im_prefs = new User_im_prefs();
+ $user_im_prefs->query('BEGIN');
$user_im_prefs->user_id = $user->id;
if($user_im_prefs->find() && $user_im_prefs->fetch())
{
$preferences = array('notify', 'updatefrompresence', 'replies', 'microid');
- $user_im_prefs->query('BEGIN');
do
{
$original = clone($user_im_prefs);
+ $new = clone($user_im_prefs);
foreach($preferences as $preference)
{
- $user_im_prefs->$preference = $this->boolean($user_im_prefs->transport . '_' . $preference);
+ $new->$preference = $this->boolean($new->transport . '_' . $preference);
}
- $result = $user_im_prefs->update($original);
+ $result = $new->update($original);
if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating IM preferences.
- $this->serverError(_('Couldn\'t update IM preferences.'));
+ $this->serverError(_('Could not update IM preferences.'));
return;
}
}while($user_im_prefs->fetch());
- $user_im_prefs->query('COMMIT');
}
+ $user_im_prefs->query('COMMIT');
// TRANS: Confirmation message for successful IM preferences save.
$this->showForm(_('Preferences saved.'), true);
}
*
* @return void
*/
-
function addAddress()
{
$user = common_current_user();
}
if (!$transport) {
+ // TRANS: Form validation error when no transport is available setting an IM address.
$this->showForm(_('No transport.'));
return;
}
if (!$screenname) {
// TRANS: Message given saving IM address that cannot be normalised.
- $this->showForm(_('Cannot normalize that screenname'));
+ $this->showForm(_('Cannot normalize that screenname.'));
return;
}
$valid = false;
Event::handle('ValidateImScreenname', array($transport, $screenname, &$valid));
if (!$valid) {
// TRANS: Message given saving IM address that not valid.
- $this->showForm(_('Not a valid screenname'));
+ $this->showForm(_('Not a valid screenname.'));
return;
} else if ($this->screennameExists($transport, $screenname)) {
// TRANS: Message given saving IM address that is already set for another user.
if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__);
- // TRANS: Server error thrown on database error adding IM confirmation code.
- $this->serverError(_('Couldn\'t insert confirmation code.'));
+ // TRANS: Server error thrown on database error adding Instant Messaging confirmation code.
+ $this->serverError(_('Could not insert confirmation code.'));
return;
}
*
* @return void
*/
-
function cancelConfirmation()
{
$screenname = $this->trimmed('screenname');
$confirm = $this->getConfirmation($transport);
if (!$confirm) {
- // TRANS: Message given canceling IM address confirmation that is not pending.
+ // TRANS: Message given canceling Instant Messaging address confirmation that is not pending.
$this->showForm(_('No pending confirmation to cancel.'));
return;
}
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling IM address confirmation.
- $this->serverError(_('Couldn\'t delete confirmation.'));
+ $this->serverError(_('Could not delete confirmation.'));
return;
}
*
* @return void
*/
-
function removeAddress()
{
$user = common_current_user();
if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered IM address.
- $this->serverError(_('Couldn\'t update user im prefs.'));
- $this->serverError(_('Couldn\'t update user.'));
+ $this->serverError(_('Could not update user IM preferences.'));
return;
}
// XXX: unsubscribe to the old address
- // TRANS: Message given after successfully removing a registered IM address.
+ // TRANS: Message given after successfully removing a registered Instant Messaging address.
$this->showForm(_('The IM address was removed.'), true);
}