aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-02-07 14:13:13 -0800
committerzotlabs <mike@macgirvin.com>2019-02-07 14:13:13 -0800
commit92e6c21210b71acb2e1071171fa8cd7e76640f7b (patch)
tree786d64833b05028ba59d07d618188f3a5f5c8da8 /Zotlabs/Lib
parentbeb26e84f3698106bd145ff21a7477e1775397dd (diff)
downloadvolse-hubzilla-92e6c21210b71acb2e1071171fa8cd7e76640f7b.tar.gz
volse-hubzilla-92e6c21210b71acb2e1071171fa8cd7e76640f7b.tar.bz2
volse-hubzilla-92e6c21210b71acb2e1071171fa8cd7e76640f7b.zip
add missing zot6 conversation completion (required for message repeats)
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/ThreadListener.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/Zotlabs/Lib/ThreadListener.php b/Zotlabs/Lib/ThreadListener.php
new file mode 100644
index 000000000..ad682aac8
--- /dev/null
+++ b/Zotlabs/Lib/ThreadListener.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace Zotlabs\Lib;
+
+class ThreadListener {
+
+ static public function store($target_id,$portable_id,$ltype = 0) {
+ $x = self::fetch($target_id,$portable_id,$ltype = 0);
+ if(! $x) {
+ $r = q("insert into listeners ( target_id, portable_id, ltype ) values ( '%s', '%s' , %d ) ",
+ dbesc($target_id),
+ dbesc($portable_id),
+ intval($ltype)
+ );
+ }
+ }
+
+ static public function fetch($target_id,$portable_id,$ltype = 0) {
+ $x = q("select * from listeners where target_id = '%s' and portable_id = '%s' and ltype = %d limit 1",
+ dbesc($target_id),
+ dbesc($portable_id),
+ intval($ltype)
+ );
+ if($x) {
+ return $x[0];
+ }
+ return false;
+ }
+
+ static public function fetch_by_target($target_id,$ltype = 0) {
+ $x = q("select * from listeners where target_id = '%s' and ltype = %d limit 1",
+ dbesc($target_id),
+ intval($ltype)
+ );
+
+ return $x;
+ }
+
+ static public function delete_by_target($target_id, $ltype = 0) {
+ return q("delete from listeners where target_id = '%s' and ltype = %d",
+ dbesc($target_id),
+ intval($ltype)
+ );
+ }
+
+ static public function delete_by_pid($portable_id, $ltype = 0) {
+ return q("delete from listeners where portable_id = '%s' and ltype = %d",
+ dbesc($portable_id),
+ intval($ltype)
+ );
+ }
+
+} \ No newline at end of file