aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/identity.php22
-rw-r--r--mod/dirprofile.php4
-rwxr-xr-xview/tpl/direntry_large.tpl2
3 files changed, 27 insertions, 1 deletions
diff --git a/include/identity.php b/include/identity.php
index ee289495d..2db5d8ece 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1170,3 +1170,25 @@ function get_online_status($nick) {
return $ret;
}
+
+
+function remote_online_status($webbie) {
+
+ $result = false;
+ $r = q("select * from hubloc where hubloc_addr = '%s' limit 1",
+ dbesc($webbie)
+ );
+ if(! $r)
+ return $result;
+
+ $url = $r[0]['hubloc_url'] . '/online/' . substr($webbie,0,strpos($webbie,'@'));
+
+ $x = z_fetch_url($url);
+ if($x['success']) {
+ $j = json_decode($x['body'],true);
+ if($j)
+ $result = (($j['result']) ? $j['result'] : false);
+ }
+ return $result;
+
+}
diff --git a/mod/dirprofile.php b/mod/dirprofile.php
index 1593b014a..d88144f52 100644
--- a/mod/dirprofile.php
+++ b/mod/dirprofile.php
@@ -74,6 +74,9 @@ function dirprofile_init(&$a) {
$qrlink = zid($rr['url']);
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
+ $online = remote_online_status($rr['address']);
+
+
if(in_array($rr['hash'],$contacts))
$connect_link = '';
@@ -151,6 +154,7 @@ function dirprofile_init(&$a) {
'$photo' => $rr['photo_l'],
'$alttext' => $rr['name'] . ' ' . $rr['address'],
'$name' => $rr['name'],
+ '$online' => (($online) ? t('Online Now') : ''),
'$details' => $pdesc . $details,
'$profile' => $profile,
'$address' => $rr['address'],
diff --git a/view/tpl/direntry_large.tpl b/view/tpl/direntry_large.tpl
index a3fa7e4c3..f00448175 100755
--- a/view/tpl/direntry_large.tpl
+++ b/view/tpl/direntry_large.tpl
@@ -13,7 +13,7 @@
<div class="clear"></div>
-<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}</div>
+<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}{{if $online}} <i class="icon-asterisk online-now" title="{{$online}}"></i>{{/if}}</div>
{{if $connect}}
<div class="directory-connect"><a href="{{$connect}}">{{$conn_label}}</a></div>
{{/if}}