]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Publish MicroIDs for email and mpp on profile and notice pages.
authormikec <mikec@mikenz.geek.nz>
Mon, 21 Jul 2008 12:00:36 +0000 (08:00 -0400)
committermikec <mikec@mikenz.geek.nz>
Mon, 21 Jul 2008 12:00:36 +0000 (08:00 -0400)
darcs-hash:20080721120036-edabd-838335c0e23c80a657d353955b25b52a9a8624b2.gz

actions/emailsettings.php
actions/imsettings.php
actions/shownotice.php
actions/showstream.php
classes/User.php
db/laconica.sql

index 2173645f759938057e807d4bbfbc30b601336a06..72bad8519f67c1e785b9e4ff715c51e95041d891 100644 (file)
@@ -83,14 +83,11 @@ class EmailsettingsAction extends SettingsAction {
                }
                
                common_element('h2', NULL, _('Preferences'));
-               
+
                common_checkbox('emailnotifysub',
-                                               _('Send me notices of new subscriptions through email.'),
-                                               $user->emailnotifysub);
-               common_checkbox('emailpost',
-                                               _('I want to post notices by email.'),
-                                               $user->emailpost);
-                       
+                               _('Send me notices of new subscriptions through email.'),
+                               $user->emailnotifysub);
+               
                common_submit('save', _('Save'));
                
                common_element_end('form');
@@ -131,8 +128,7 @@ class EmailsettingsAction extends SettingsAction {
        function save_preferences() {
 
                $emailnotifysub = $this->boolean('emailnotifysub');
-               $emailpost = $this->boolean('emailpost');
-               
+
                $user = common_current_user();
 
                assert(!is_null($user)); # should already be checked
@@ -142,7 +138,6 @@ class EmailsettingsAction extends SettingsAction {
                $original = clone($user);
 
                $user->emailnotifysub = $emailnotifysub;
-               $user->emailpost = $emailpost;
 
                $result = $user->update($original);
 
index d1ed48efb38912de47e27a5158cafa3aff3e834a..034f6dc2b284518ef50e6e3bae1416403ef180be 100644 (file)
@@ -75,6 +75,9 @@ class ImsettingsAction extends SettingsAction {
                common_checkbox('jabberreplies',
                                _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
                                $user->jabberreplies);
+               common_checkbox('jabbermicroid',
+                               _('Publish a MicroID for my Jabber/GTalk address.'),
+                               $user->jabbermicroid);
                common_submit('save', _('Save'));
 
                common_element_end('form');
@@ -113,6 +116,7 @@ class ImsettingsAction extends SettingsAction {
                $jabbernotify = $this->boolean('jabbernotify');
                $updatefrompresence = $this->boolean('updatefrompresence');
                $jabberreplies = $this->boolean('jabberreplies');
+               $jabbermicroid = $this->boolean('jabbermicroid');
 
                $user = common_current_user();
 
@@ -125,6 +129,7 @@ class ImsettingsAction extends SettingsAction {
                $user->jabbernotify = $jabbernotify;
                $user->updatefrompresence = $updatefrompresence;
                $user->jabberreplies = $jabberreplies;
+               $user->jabbermicroid = $jabbermicroid;
 
                $result = $user->update($original);
 
index c05537c38ebb4d80198fd10cb8d30b3823f0fc0d..f9531b3c40378bf27cd4e5fc13c4896a0f1381f4 100644 (file)
@@ -43,7 +43,7 @@ class ShownoticeAction extends StreamAction {
                # Looks like we're good; show the header
 
                common_show_header(sprintf(_('%1$s\'s status on %2$s'), $profile->nickname, common_exact_date($notice->created)),
-                                                  NULL, $profile,
+                                                  array($this, 'show_header'), $notice,
                                                   array($this, 'show_top'));
 
                common_element_start('ul', array('id' => 'notices'));
@@ -53,7 +53,25 @@ class ShownoticeAction extends StreamAction {
                common_show_footer();
        }
 
-       function show_top($user) {
+       function show_header($notice)
+       {
+               $profile = $notice->getProfile();
+               $user = User::staticGet($profile->id);
+               if (!$user) {
+                       return;
+               }
+               if ($user->emailmicroid && $user->email && $notice->uri) {
+                       common_element('meta', array('name' => 'microid',
+                                                                                'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($notice->uri))));
+               }
+               if ($user->jabbermicroid && $user->jabber && $notice->uri) {
+                       common_element('meta', array('name' => 'microid',
+                                                                                'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($notice->uri))));
+               }
+       }
+
+       function show_top($notice) {
+               $user = $notice->getProfile();
                $cur = common_current_user();
 
                if ($cur && $cur->id == $user->id) {
index 8b473f76a4ce789e04921fab786466c9944333a9..fba68d129d646e9bbf3f2fc2556fad236393903c 100644 (file)
@@ -94,6 +94,16 @@ class ShowstreamAction extends StreamAction {
                        common_element('meta', array('name' => 'description',
                                                                                 'content' => $profile->bio));
                }
+
+               if ($user->emailmicroid && $user->email && $profile->profileurl) {
+                       common_element('meta', array('name' => 'microid',
+                                                                                'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
+               }
+               if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
+                       common_element('meta', array('name' => 'microid',
+                                                                                'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
+               }
+
        }
 
        function no_such_user() {
index bded1e0be615be72c678a2e9580bfaf3802a680d..b7feab60230c81247dd0aaa72abb779b89a2ea45 100644 (file)
@@ -39,6 +39,7 @@ class User extends DB_DataObject
     public $jabber;                          // varchar(255)  unique_key
     public $jabbernotify;                    // tinyint(1)  
     public $jabberreplies;                   // tinyint(1)  
+    public $jabbermicroid;                   // tinyint(1)   default_1
     public $updatefrompresence;              // tinyint(1)  
     public $sms;                             // varchar(64)  unique_key
     public $carrier;                         // int(4)  
index 3e8361bc67279a8e42a34e5eaecd1145a5f70fd7..79c34e712a0dc7227f17f8140716c911fe8150aa 100644 (file)
@@ -50,6 +50,7 @@ create table user (
     jabber varchar(255) unique key comment 'jabber ID for notices',
     jabbernotify tinyint default 0 comment 'whether to send notices to jabber',
     jabberreplies tinyint default 0 comment 'whether to send notices to jabber on replies',
+    jabbermicroid tinyint default 1 comment 'whether to publish xmpp microid',
     updatefrompresence tinyint default 0 comment 'whether to record updates from Jabber presence notices',
     sms varchar(64) unique key comment 'sms phone number',
     carrier integer comment 'foreign key to sms_carrier' references sms_carrier (id),