// XXX: Do some error handling here
+ $this->setDefaults();
+
$this->showHome($flink, _('You can now use Identi.ca from Facebook!'));
} else {
$this->showLoginForm($msg);
}
+ function setDefaults()
+ {
+ $facebook = get_facebook();
+
+ // A default prefix string for notices
+ $facebook->api_client->data_setUserPreference(1, 'dented: ');
+ }
+
function showHome($flink, $msg)
{
-
+
$facebook = get_facebook();
$fbuid = $facebook->require_login();
-
+
$user = $flink->getUser();
-
+
$notice = $user->getCurrentNotice();
update_profile_box($facebook, $fbuid, $user, $notice);
-
-
+
+
$this->show_header('Home');
if ($msg) {
common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
common_element('p', null, _('Invitations have been sent to the following users:'));
- $friend_ids = $_POST['ids']; // Hmm... $arg->('ids) doesn't seem to work
+ $friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
common_element_start("ul");
$noticesync = $this->arg('noticesync');
$replysync = $this->arg('replysync');
+ $prefix = $this->trimmed('prefix');
$facebook = get_facebook();
$fbuid = $facebook->require_login();
$flink->set_flags($noticesync, $replysync, false);
$result = $flink->update($original);
+ $facebook->api_client->data_setUserPreference(1, substr($prefix, 0, 128));
+
if ($result) {
$this->show_form('Sync preferences saved.', true);
} else {
common_checkbox('replysync', _('Send local "@" replies to Facebook.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
+ // function common_input($id, $label, $value=null,$instructions=null)
+
+ $prefix = $facebook->api_client->data_getUserPreference(1);
+
+
+ common_input('prefix', _('Prefix'),
+ ($prefix) ? $prefix : null,
+ _('A string to prefix notices with.'));
common_submit('save', _('Save'));
common_element_end('form');
$flink = Foreign_link::getByUserID($notice->profile_id, FACEBOOK_SERVICE);
$user = $flink->getUser();
$fbuid = $flink->foreign_id;
- $content = $notice->content;
+
+ $prefix = $facebook->api_client->data_getUserPreference(1, $fbuid);
+
+ $content = "$prefix $notice->content";
if (($flink->noticesync & FOREIGN_NOTICE_SEND) == FOREIGN_NOTICE_SEND) {