- https://alpha.app.net/opendev/post/34396399 - location data
*/
+require_once('include/enotify.php');
+
define('APPNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes
function appnet_install() {
register_hook('connector_settings', 'addon/appnet/appnet.php', 'appnet_settings');
register_hook('connector_settings_post','addon/appnet/appnet.php', 'appnet_settings_post');
register_hook('prepare_body', 'addon/appnet/appnet.php', 'appnet_prepare_body');
+ register_hook('check_item_notification','addon/appnet/appnet.php', 'appnet_check_item_notification');
}
unregister_hook('connector_settings', 'addon/appnet/appnet.php', 'appnet_settings');
unregister_hook('connector_settings_post', 'addon/appnet/appnet.php', 'appnet_settings_post');
unregister_hook('prepare_body', 'addon/appnet/appnet.php', 'appnet_prepare_body');
+ unregister_hook('check_item_notification','addon/appnet/appnet.php', 'appnet_check_item_notification');
}
function appnet_module() {}
return $o;
}
+function appnet_check_item_notification($a, &$notification_data) {
+ $own_id = get_pconfig($notification_data["uid"], 'appnet', 'ownid');
+
+ $own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
+ intval($notification_data["uid"]),
+ dbesc("adn::".$own_id)
+ );
+
+ if ($own_user)
+ $notification_data["profiles"][] = $own_user[0]["url"];
+}
+
function appnet_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/appnet/" );
$lastid = $post["id"];
- if (($item != 0) AND ($postarray['contact-id'] != $me["id"])) {
+ if (($item != 0) AND ($postarray['contact-id'] != $me["id"]) AND !function_exists("check_item_notification")) {
$r = q("SELECT `thread`.`iid` AS `parent` FROM `thread`
INNER JOIN `item` ON `thread`.`iid` = `item`.`parent` AND `thread`.`uid` = `item`.`uid`
WHERE `item`.`id` = %d AND `thread`.`mention` LIMIT 1", dbesc($item));
$parent_id = 0;
logger('appnet_fetchstream: User '.$uid.' posted mention item '.$item);
+
+ if ($item AND function_exists("check_item_notification"))
+ check_item_notification($item, $uid, NOTIFY_TAGSELF);
+
} else {
$item = 0;
$parent_id = 0;
$lastid = $post["id"];
//if (($item != 0) AND ($postarray['contact-id'] != $me["id"])) {
- if ($item != 0) {
+ if (($item != 0) AND !function_exists("check_item_notification")) {
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_TAGSELF,
*/
require('addon/pumpio/oauth/http.php');
require('addon/pumpio/oauth/oauth_client.php');
+require_once('include/enotify.php');
define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes
register_hook('connector_settings_post', 'addon/pumpio/pumpio.php', 'pumpio_settings_post');
register_hook('cron', 'addon/pumpio/pumpio.php', 'pumpio_cron');
register_hook('queue_predeliver', 'addon/pumpio/pumpio.php', 'pumpio_queue_hook');
+ register_hook('check_item_notification','addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
}
function pumpio_uninstall() {
unregister_hook('connector_settings_post', 'addon/pumpio/pumpio.php', 'pumpio_settings_post');
unregister_hook('cron', 'addon/pumpio/pumpio.php', 'pumpio_cron');
unregister_hook('queue_predeliver', 'addon/pumpio/pumpio.php', 'pumpio_queue_hook');
+ unregister_hook('check_item_notification','addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
}
function pumpio_module() {}
return $o;
}
+function pumpio_check_item_notification($a, &$notification_data) {
+ $hostname = get_pconfig($notification_data["uid"], 'pumpio','host');
+ $username = get_pconfig($notification_data["uid"], "pumpio", "user");
+
+ $notification_data["profiles"][] = "https://".$hostname."/".$username;
+}
+
+
function pumpio_registerclient(&$a, $host) {
$url = "https://".$host."/api/client/register";
// Searching for the liked post
// Two queries for speed issues
- $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1",
dbesc($post->object->id),
- intval($uid)
+ intval($uid),
+ dbesc(NETWORK_PUMPIO)
);
if (count($r))
$orig_post = $r[0];
else {
- $r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1",
dbesc($post->object->id),
- intval($uid)
+ intval($uid),
+ dbesc(NETWORK_PUMPIO)
);
if (!count($r))
if (link_compare($own_id, $postarray['author-link']))
return $top_item;
- $myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
- dbesc($postarray['parent-uri']),
- intval($uid)
- );
-
- if(count($myconv)) {
-
- foreach($myconv as $conv) {
- // now if we find a match, it means we're in this conversation
-
- if(!link_compare($conv['author-link'],$importer_url) AND !link_compare($conv['author-link'],$own_id))
- continue;
+ if (!function_exists("check_item_notification")) {
+ $myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
+ dbesc($postarray['parent-uri']),
+ intval($uid)
+ );
- require_once('include/enotify.php');
-
- $conv_parent = $conv['parent'];
-
- notification(array(
- 'type' => NOTIFY_COMMENT,
- 'notify_flags' => $user[0]['notify-flags'],
- 'language' => $user[0]['language'],
- 'to_name' => $user[0]['username'],
- 'to_email' => $user[0]['email'],
- 'uid' => $user[0]['uid'],
- 'item' => $postarray,
- 'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($top_item)),
- 'source_name' => $postarray['author-name'],
- 'source_link' => $postarray['author-link'],
- 'source_photo' => $postarray['author-avatar'],
- 'verb' => ACTIVITY_POST,
- 'otype' => 'item',
- 'parent' => $conv_parent,
- ));
-
- // only send one notification
- break;
+ if(count($myconv)) {
+
+ foreach($myconv as $conv) {
+ // now if we find a match, it means we're in this conversation
+
+ if(!link_compare($conv['author-link'],$importer_url) AND !link_compare($conv['author-link'],$own_id))
+ continue;
+
+ require_once('include/enotify.php');
+
+ $conv_parent = $conv['parent'];
+
+ notification(array(
+ 'type' => NOTIFY_COMMENT,
+ 'notify_flags' => $user[0]['notify-flags'],
+ 'language' => $user[0]['language'],
+ 'to_name' => $user[0]['username'],
+ 'to_email' => $user[0]['email'],
+ 'uid' => $user[0]['uid'],
+ 'item' => $postarray,
+ 'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($top_item)),
+ 'source_name' => $postarray['author-name'],
+ 'source_link' => $postarray['author-link'],
+ 'source_photo' => $postarray['author-avatar'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item',
+ 'parent' => $conv_parent,
+ ));
+
+ // only send one notification
+ break;
+ }
}
}
}
define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes
require_once('library/twitteroauth.php');
+require_once('include/enotify.php');
class StatusNetOAuth extends TwitterOAuth {
function get_maxlength() {
register_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
register_hook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron');
register_hook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body');
+ register_hook('check_item_notification','addon/statusnet/statusnet.php', 'statusnet_check_item_notification');
logger("installed GNU Social");
}
unregister_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
unregister_hook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron');
unregister_hook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body');
+ unregister_hook('check_item_notification','addon/statusnet/statusnet.php', 'statusnet_check_item_notification');
// old setting - remove only
unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
}
+function statusnet_check_item_notification($a, &$notification_data) {
+ $notification_data["profiles"][] = get_pconfig($notification_data["uid"], 'statusnet', 'own_url');
+}
+
function statusnet_jot_nets(&$a,&$b) {
if(! local_user())
return;
logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
- if ($item != 0)
+ if ($item AND !function_exists("check_item_notification"))
statusnet_checknotification($a, $uid, $nick, $item, $postarray);
}
$postarray["id"] = $item;
logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item);
+
+ if ($item AND function_exists("check_item_notification"))
+ check_item_notification($item, $uid, NOTIFY_TAGSELF);
}
}
$parent_id = $r[0]['parent'];
}
- if ($item != 0) {
+ if (($item != 0) AND !function_exists("check_item_notification")) {
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_TAGSELF,
$api = get_pconfig($uid, 'statusnet', 'baseapi');
$otoken = get_pconfig($uid, 'statusnet', 'oauthtoken');
$osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
+ $own_url = get_pconfig($uid, 'statusnet', 'own_url');
require_once('library/twitteroauth.php');
logger('statusnet_complete_conversation: User '.$self["nick"].' posted home timeline item '.$item);
- if ($item != 0)
+ if ($item AND !function_exists("check_item_notification"))
statusnet_checknotification($a, $uid, $nick, $item, $postarray);
}
}
* Requirements: PHP5, curl [Slinky library]
*/
+require_once('include/enotify.php');
+
define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes
function twitter_install() {
register_hook('follow', 'addon/twitter/twitter.php', 'twitter_follow');
register_hook('expire', 'addon/twitter/twitter.php', 'twitter_expire');
register_hook('prepare_body', 'addon/twitter/twitter.php', 'twitter_prepare_body');
+ register_hook('check_item_notification','addon/twitter/twitter.php', 'twitter_check_item_notification');
logger("installed twitter");
}
unregister_hook('follow', 'addon/twitter/twitter.php', 'twitter_follow');
unregister_hook('expire', 'addon/twitter/twitter.php', 'twitter_expire');
unregister_hook('prepare_body', 'addon/twitter/twitter.php', 'twitter_prepare_body');
+ unregister_hook('check_item_notification','addon/twitter/twitter.php', 'twitter_check_item_notification');
// old setting - remove only
unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
}
+function twitter_check_item_notification($a, &$notification_data) {
+ $own_id = get_pconfig($notification_data["uid"], 'twitter', 'own_id');
+
+ $own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
+ intval($notification_data["uid"]),
+ dbesc("twitter::".$own_id)
+ );
+
+ if ($own_user)
+ $notification_data["profiles"][] = $own_user[0]["url"];
+}
+
function twitter_follow($a, &$contact) {
logger("twitter_follow: Check if contact is twitter contact. ".$contact["url"], LOGGER_DEBUG);
if (count($r))
break;
-
+
$posts[] = $post;
}
logger('twitter_fetchparentpost: User '.$self["nick"].' posted parent timeline item '.$item);
- if ($item != 0)
+ if ($item AND !function_exists("check_item_notification"))
twitter_checknotification($a, $uid, $own_id, $item, $postarray);
}
}
logger('twitter_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
- if ($item != 0)
+ if ($item AND !function_exists("check_item_notification"))
twitter_checknotification($a, $uid, $own_id, $item, $postarray);
}
$item = item_store($postarray);
$postarray["id"] = $item;
+ if ($item AND function_exists("check_item_notification"))
+ check_item_notification($item, $uid, NOTIFY_TAGSELF);
+
if (!isset($postarray["parent"]) OR ($postarray["parent"] == 0))
$postarray["parent"] = $item;
} else
$parent_id = $postarray['parent'];
- if ($item != 0) {
+ if (($item != 0) AND !function_exists("check_item_notification")) {
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_TAGSELF,