aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-08 02:49:08 -0800
committerfriendica <info@friendica.com>2013-01-08 02:49:08 -0800
commitba20913c2b1fde5fdc9a25e5efa0c1d3a55d74c4 (patch)
tree2eb7b84c8ab85ba00e0f0ff1055f14d56e4ddfd5 /mod
parent7f6e1144f659c94f19881899db0d4b891690b759 (diff)
downloadvolse-hubzilla-ba20913c2b1fde5fdc9a25e5efa0c1d3a55d74c4.tar.gz
volse-hubzilla-ba20913c2b1fde5fdc9a25e5efa0c1d3a55d74c4.tar.bz2
volse-hubzilla-ba20913c2b1fde5fdc9a25e5efa0c1d3a55d74c4.zip
lots of notification tweaks
Diffstat (limited to 'mod')
-rw-r--r--mod/notify.php1
-rw-r--r--mod/ping.php39
2 files changed, 40 insertions, 0 deletions
diff --git a/mod/notify.php b/mod/notify.php
index dd26bfe7e..3157e8ce8 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -23,6 +23,7 @@ function notify_init(&$a) {
goaway($a->get_baseurl(true));
}
+
if(argc() > 2 && argv(1) === 'mark' && argv(2) === 'all' ) {
$r = q("update notify set seen = 1 where uid = %d",
intval(local_user())
diff --git a/mod/ping.php b/mod/ping.php
index 76d139711..b128cffeb 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -82,6 +82,42 @@ function ping_init(&$a) {
'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
'message' => strip_tags(bbcode($zz['msg']))
);
+ logger('notifs: ' . print_r($notifs,true));
+ }
+
+
+ }
+
+ echo json_encode(array('notify' => $notifs));
+ killme();
+
+ }
+
+
+ if(argc() > 1 && argv(1) === 'messages') {
+
+ $channel = $a->get_channel();
+ $t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan
+ where channel_id = %d and ( mail_flags & %d ) and not (mail_flags & %d )
+ and from_xchan != '%s' order by created desc limit 0,50",
+ intval(local_user()),
+ intval(MAIL_SEEN),
+ intval(MAIL_DELETED),
+ dbesc($channel['channel_hash'])
+ );
+
+ if($t) {
+ foreach($t as $zz) {
+// $msg = sprintf( t('sent you a private message.'), $zz['xchan_name']);
+ $notifs[] = array(
+ 'notify_link' => $a->get_baseurl() . '/message/' . $zz['id'],
+ 'name' => $zz['xchan_name'],
+ 'url' => $zz['xchan_url'],
+ 'photo' => $zz['xchan_photo_s'],
+ 'when' => relative_date($zz['created']),
+ 'class' => (($zz['mail_flags'] & MAIL_SEEN) ? 'notify-seen' : 'notify-unseen'),
+ 'message' => t('sent you a private message'),
+ );
}
}
@@ -90,6 +126,9 @@ function ping_init(&$a) {
}
+
+
+
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();