diff options
-rw-r--r-- | mod/ping.php | 34 | ||||
-rw-r--r-- | version.inc | 2 |
2 files changed, 33 insertions, 3 deletions
diff --git a/mod/ping.php b/mod/ping.php index cdc18a303..9650f2aec 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -93,14 +93,14 @@ function ping_init(&$a) { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { $result = array(); -dbg(1); + $r = q("SELECT * FROM item WHERE item_restrict = %d and ( item_flags & %d ) and uid = %d", intval(ITEM_VISIBLE), intval(ITEM_UNSEEN), intval(local_user()) ); -dbg(0); + if($r) { xchan_query($r); foreach($r as $item) { @@ -115,6 +115,36 @@ dbg(0); } + if(argc() > 1 && (argv(1) === 'connect')) { + + $result = array(); + + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash + WHERE abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d)", + intval(local_user()), + intval(ABOOK_FLAG_PENDING), + intval(ABOOK_FLAG_SELF) + ); + + if($r) { + foreach($r as $rr) { + $result[] = array( + 'notify_link' => $a->get_baseurl() . '/notify/view-intro/' . $rr['abook_id'], + 'name' => $rr['xchan_name'], + 'url' => $rr['xchan_url'], + 'photo' => $rr['xchan_photo_s'], + 'when' => relative_date($rr['abook_created']), + 'class' => ('notify-unseen'), + 'message' => strip_tags(sprintf( t("Connection request from %s"), $rr['xchan_name'])) + ); + } + } + logger('ping: ' . print_r($result,true)); + echo json_encode(array( argv(1) => $result)); + killme(); + + } + // Normal ping - just the counts diff --git a/version.inc b/version.inc index 5b42a888d..276dce6a7 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-12-01.156 +2012-12-02.157 |