Add option to Twitter settings for importing Friends Timeline

This commit is contained in:
Zach Copley 2009-04-13 19:19:26 -07:00
parent 4f966709e6
commit ad5dd9030b
2 changed files with 23 additions and 8 deletions

View File

@ -138,7 +138,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('noticesync', $this->checkbox('noticesend',
_('Automatically send my notices to Twitter.'), _('Automatically send my notices to Twitter.'),
($flink) ? ($flink) ?
($flink->noticesync & FOREIGN_NOTICE_SEND) : ($flink->noticesync & FOREIGN_NOTICE_SEND) :
@ -158,6 +158,13 @@ class TwittersettingsAction extends ConnectSettingsAction
($flink->friendsync & FOREIGN_FRIEND_RECV) : ($flink->friendsync & FOREIGN_FRIEND_RECV) :
false); false);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('noticerecv',
_('Import my Friends Timeline.'),
($flink) ?
($flink->noticesync & FOREIGN_NOTICE_RECV) :
false);
$this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
if ($flink) { if ($flink) {
@ -261,7 +268,7 @@ class TwittersettingsAction extends ConnectSettingsAction
'alt' => ($other->fullname) ? 'alt' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname)); $other->nickname));
$this->element('span', 'fn nickname', $other->nickname); $this->element('span', 'fn nickname', $other->nickname);
$this->elementEnd('a'); $this->elementEnd('a');
$this->elementEnd('li'); $this->elementEnd('li');
@ -320,7 +327,8 @@ class TwittersettingsAction extends ConnectSettingsAction
{ {
$screen_name = $this->trimmed('twitter_username'); $screen_name = $this->trimmed('twitter_username');
$password = $this->trimmed('twitter_password'); $password = $this->trimmed('twitter_password');
$noticesync = $this->boolean('noticesync'); $noticesend = $this->boolean('noticesend');
$noticerecv = $this->boolean('noticerecv');
$replysync = $this->boolean('replysync'); $replysync = $this->boolean('replysync');
$friendsync = $this->boolean('friendsync'); $friendsync = $this->boolean('friendsync');
@ -363,7 +371,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$flink->credentials = $password; $flink->credentials = $password;
$flink->created = common_sql_now(); $flink->created = common_sql_now();
$flink->set_flags($noticesync, $replysync, $friendsync); $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync);
$flink_id = $flink->insert(); $flink_id = $flink->insert();
@ -419,7 +427,8 @@ class TwittersettingsAction extends ConnectSettingsAction
function savePreferences() function savePreferences()
{ {
$noticesync = $this->boolean('noticesync'); $noticesend = $this->boolean('noticesend');
$noticerecv = $this->boolean('noticerecv');
$friendsync = $this->boolean('friendsync'); $friendsync = $this->boolean('friendsync');
$replysync = $this->boolean('replysync'); $replysync = $this->boolean('replysync');
@ -448,7 +457,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$original = clone($flink); $original = clone($flink);
$flink->set_flags($noticesync, $replysync, $friendsync); $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync);
$result = $flink->update($original); $result = $flink->update($original);

View File

@ -57,13 +57,19 @@ class Foreign_link extends Memcached_DataObject
return null; return null;
} }
function set_flags($noticesync, $replysync, $friendsync) function set_flags($noticesend, $noticerecv, $replysync, $friendsync)
{ {
if ($noticesync) { if ($noticesend) {
$this->noticesync |= FOREIGN_NOTICE_SEND; $this->noticesync |= FOREIGN_NOTICE_SEND;
} else { } else {
$this->noticesync &= ~FOREIGN_NOTICE_SEND; $this->noticesync &= ~FOREIGN_NOTICE_SEND;
} }
if ($noticerecv) {
$this->noticesync |= FOREIGN_NOTICE_RECV;
} else {
$this->noticesync &= ~FOREIGN_NOTICE_RECV;
}
if ($replysync) { if ($replysync) {
$this->noticesync |= FOREIGN_NOTICE_SEND_REPLY; $this->noticesync |= FOREIGN_NOTICE_SEND_REPLY;