aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-04-27 05:56:19 -0400
committerAndrew Manning <tamanning@zoho.com>2016-04-27 05:56:19 -0400
commitf975d9dfe457cb6912e7e0907406a86556537524 (patch)
tree10c02ebfbd5f2acf1f2944b0f28f7c97c4b8454a /include
parentf027bf81cdaddee5d6474199c1b7adce50e6e07d (diff)
parenta6baa5a6da5f5231c119cab3170f68cf271f703b (diff)
downloadvolse-hubzilla-f975d9dfe457cb6912e7e0907406a86556537524.tar.gz
volse-hubzilla-f975d9dfe457cb6912e7e0907406a86556537524.tar.bz2
volse-hubzilla-f975d9dfe457cb6912e7e0907406a86556537524.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into help-content
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php44
-rw-r--r--include/config.php157
-rwxr-xr-xinclude/dba/dba_mysqli.php18
-rw-r--r--include/import.php30
-rwxr-xr-xinclude/items.php155
-rw-r--r--include/network.php5
-rw-r--r--include/notifier.php19
-rw-r--r--include/text.php29
-rw-r--r--include/zot.php2
9 files changed, 242 insertions, 217 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 78a2759c1..b8cd23f59 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -330,8 +330,19 @@ function bb_map_location($match) {
}
function bb_opentag($match) {
+ $openclose = (($match[2]) ? '<span class="bb-open" title="' . t('Click to open/close') . '">' . $match[1] . '</span>' : t('Click to open/close'));
+ $text = (($match[2]) ? $match[2] : $match[1]);
$rnd = mt_rand();
- return "<br /><div onclick=\"openClose('opendiv-" . $rnd . "');return false;\" class=\"fakelink\">" . $match[1] . "</div><div id=\"opendiv-" . $rnd . "\" style=\"display: none;\">" . $match[2] . "</div>";
+
+ return '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><div id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</div>';
+}
+
+function bb_spoilertag($match) {
+ $openclose = (($match[2]) ? '<span class="bb-spoiler" title="' . t('Click to open/close') . '">' . $match[1] . ' ' . t('spoiler') . '</span>' : t('Click to open/close'));
+ $text = (($match[2]) ? $match[2] : $match[1]);
+ $rnd = mt_rand();
+
+ return '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><blockquote id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</blockquote>';
}
/**
@@ -748,33 +759,34 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text);
}
- // Declare the format for [spoiler] layout
- $SpoilerLayout = '<blockquote class="spoiler">$1</blockquote>';
-
// Check for [spoiler] text
- // handle nested quotes
$endlessloop = 0;
- while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20))
- $Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $Text);
+ while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) {
+ $Text = preg_replace_callback("/\[spoiler\](.*?)\[\/spoiler\]/ism", 'bb_spoilertag', $Text);
+ }
// Check for [spoiler=Author] text
-
- $t_wrote = t('$1 spoiler');
-
- // handle nested quotes
$endlessloop = 0;
- while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20))
- $Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism",
- "<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>",
- $Text);
+ while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20)) {
+ $Text = preg_replace_callback("/\[spoiler=(.*?)\](.*?)\[\/spoiler\]/ism", 'bb_spoilertag', $Text);
+ }
+ // Check for [open] text
+ $endlessloop = 0;
+ while ((strpos($Text, "[/open]")!== false) and (strpos($Text, "[open]") !== false) and (++$endlessloop < 20)) {
+ $Text = preg_replace_callback("/\[open\](.*?)\[\/open\]/ism", 'bb_opentag', $Text);
+ }
+ // Check for [open=Title] text
$endlessloop = 0;
while ((strpos($Text, "[/open]")!== false) and (strpos($Text, "[open=") !== false) and (++$endlessloop < 20)) {
$Text = preg_replace_callback("/\[open=(.*?)\](.*?)\[\/open\]/ism", 'bb_opentag', $Text);
}
+
+
+
// Declare the format for [quote] layout
$QuoteLayout = '<blockquote>$1</blockquote>';
@@ -792,7 +804,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$endlessloop = 0;
while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20))
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
- "<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
+ "<span class=".'"bb-quote"'.">" . $t_wrote . "</span><blockquote>$2</blockquote>",
$Text);
// Images
diff --git a/include/config.php b/include/config.php
index 712b4ca11..12768f4da 100644
--- a/include/config.php
+++ b/include/config.php
@@ -625,3 +625,160 @@ function del_abconfig($chash,$xhash,$family,$key) {
return $r;
}
+
+
+
+
+
+
+function get_iconfig(&$item, $family, $key) {
+
+ $is_item = false;
+ if(is_array($item)) {
+ $is_item = true;
+ if((! array_key_exists('iconfig',$item)) || (! is_array($item['iconfig'])))
+ $item['iconfig'] = array();
+
+ if(array_key_exists('item_id',$item))
+ $iid = $item['item_id'];
+ else
+ $iid = $item['id'];
+ }
+ elseif(intval($item))
+ $iid = $item;
+
+ if(! $iid)
+ return false;
+
+ if(is_array($item) && array_key_exists('iconfig',$item) && is_array($item['iconfig'])) {
+ foreach($item['iconfig'] as $c) {
+ if($c['iid'] == $iid && $c['cat'] == $family && $c['k'] == $key)
+ return $c['v'];
+ }
+ }
+
+ $r = q("select * from iconfig where iid = %d and cat = '%s' and k = '%s' limit 1",
+ intval($iid),
+ dbesc($family),
+ dbesc($key)
+ );
+ if($r) {
+ $r[0]['v'] = ((preg_match('|^a:[0-9]+:{.*}$|s',$r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']);
+ if($is_item)
+ $item['iconfig'][] = $r[0];
+ return $r[0]['v'];
+ }
+ return false;
+
+}
+
+/**
+ * set_iconfig(&$item, $family, $key, $value, $sharing = false);
+ *
+ * $item - item array or item id. If passed an array the iconfig meta information is
+ * added to the item structure (which will need to be saved with item_store eventually).
+ * If passed an id, the DB is updated, but may not be federated and/or cloned.
+ * $family - namespace of meta variable
+ * $key - key of meta variable
+ * $value - value of meta variable
+ * $sharing - boolean (default false); if true the meta information is propagated with the item
+ * to other sites/channels, mostly useful when $item is an array and has not yet been stored/delivered.
+ * If the meta information is added after delivery and you wish it to be shared, it may be necessary to
+ * alter the item edited timestamp and invoke the delivery process on the updated item. The edited
+ * timestamp needs to be altered in order to trigger an item_store_update() at the receiving end.
+ */
+
+
+function set_iconfig(&$item, $family, $key, $value, $sharing = false) {
+
+ $dbvalue = ((is_array($value)) ? serialize($value) : $value);
+ $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
+
+ $is_item = false;
+ $idx = null;
+
+ if(is_array($item)) {
+ $is_item = true;
+ if((! array_key_exists('iconfig',$item)) || (! is_array($item['iconfig'])))
+ $item['iconfig'] = array();
+ elseif($item['iconfig']) {
+ for($x = 0; $x < count($item['iconfig']); $x ++) {
+ if($item['iconfig'][$x]['cat'] == $family && $item['iconfig'][$x]['k'] == $key) {
+ $idx = $x;
+ }
+ }
+ }
+ $entry = array('cat' => $family, 'k' => $key, 'v' => $value, 'sharing' => $sharing);
+
+ if(is_null($idx))
+ $item['iconfig'][] = $entry;
+ else
+ $item['iconfig'][$idx] = $entry;
+ return $value;
+ }
+
+ if(intval($item))
+ $iid = intval($item);
+
+ if(! $iid)
+ return false;
+
+ if(get_iconfig($item, $family, $key) === false) {
+ $r = q("insert into iconfig( iid, cat, k, v, sharing ) values ( %d, '%s', '%s', '%s', %d ) ",
+ intval($iid),
+ dbesc($family),
+ dbesc($key),
+ dbesc($dbvalue),
+ intval($sharing)
+ );
+ }
+ else {
+ $r = q("update iconfig set v = '%s', sharing = %d where iid = %d and cat = '%s' and k = '%s' ",
+ dbesc($dbvalue),
+ intval($sharing),
+ intval($iid),
+ dbesc($family),
+ dbesc($key)
+ );
+ }
+
+ if(! $r)
+ return false;
+
+ return $value;
+}
+
+
+
+function del_iconfig(&$item, $family, $key) {
+
+
+ $is_item = false;
+ $idx = null;
+
+ if(is_array($item)) {
+ $is_item = true;
+ if(is_array($item['iconfig'])) {
+ for($x = 0; $x < count($item['iconfig']); $x ++) {
+ if($item['iconfig'][$x]['cat'] == $family && $item['iconfig'][$x]['k'] == $key) {
+ unset($item['iconfig'][$x]);
+ }
+ }
+ }
+ return true;
+ }
+
+ if(intval($item))
+ $iid = intval($item);
+
+ if(! $iid)
+ return false;
+
+ return q("delete from iconfig where iid = %d and cat = '%s' and k = '%s' ",
+ intval($iid),
+ dbesc($family),
+ dbesc($key)
+ );
+
+}
+
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
index 6986d4586..57a7559a1 100755
--- a/include/dba/dba_mysqli.php
+++ b/include/dba/dba_mysqli.php
@@ -4,20 +4,26 @@ require_once('include/dba/dba_driver.php');
class dba_mysqli extends dba_driver {
- function connect($server, $port, $user,$pass,$db) {
+ function connect($server,$port,$user,$pass,$db) {
if($port)
$this->db = new mysqli($server,$user,$pass,$db, $port);
else
$this->db = new mysqli($server,$user,$pass,$db);
- if(! mysqli_connect_errno()) {
- $this->connected = true;
+ if($this->db->connect_error) {
+ $this->connected = false;
+ $this->error = $this->db->connect_error;
+
+ if(file_exists('dbfail.out')) {
+ file_put_contents('dbfail.out', datetime_convert() . "\nConnect: " . $this->error . "\n", FILE_APPEND);
+ }
+
+ return false;
}
- if($this->connected) {
+ else {
+ $this->connected = true;
return true;
}
- $this->error = $this->db->connect_error;
- return false;
}
function q($sql) {
diff --git a/include/import.php b/include/import.php
index 3b5c8508c..f6e62f9e0 100644
--- a/include/import.php
+++ b/include/import.php
@@ -482,7 +482,7 @@ function sync_chatrooms($channel,$chatrooms) {
-function import_items($channel,$items) {
+function import_items($channel,$items,$sync = false) {
if($channel && $items) {
$allow_code = false;
@@ -499,6 +499,7 @@ function import_items($channel,$items) {
$deliver = false; // Don't deliver any messages or notifications when importing
foreach($items as $i) {
+ $item_result = false;
$item = get_item_elements($i,$allow_code);
if(! $item)
continue;
@@ -511,7 +512,13 @@ function import_items($channel,$items) {
if($item['edited'] > $r[0]['edited']) {
$item['id'] = $r[0]['id'];
$item['uid'] = $channel['channel_id'];
- item_store_update($item,$allow_code,$deliver);
+ $item_result = item_store_update($item,$allow_code,$deliver);
+ if($sync && $item['item_wall']) {
+ // deliver singletons if we have any
+ if($item_result && $item_result['success']) {
+ proc_run('php','include/notifier.php','single_activity',$item_result['item_id']);
+ }
+ }
continue;
}
}
@@ -520,13 +527,19 @@ function import_items($channel,$items) {
$item['uid'] = $channel['channel_id'];
$item_result = item_store($item,$allow_code,$deliver);
}
+ if($sync && $item['item_wall']) {
+ // deliver singletons if we have any
+ if($item_result && $item_result['success']) {
+ proc_run('php','include/notifier.php','single_activity',$item_result['item_id']);
+ }
+ }
}
}
}
function sync_items($channel,$items) {
- import_items($channel,$items);
+ import_items($channel,$items,true);
}
@@ -839,7 +852,7 @@ function import_conv($channel,$convs) {
-function import_mail($channel,$mails) {
+function import_mail($channel,$mails,$sync = false) {
if($channel && $mails) {
foreach($mails as $mail) {
if(array_key_exists('flags',$mail) && in_array('deleted',$mail['flags'])) {
@@ -863,12 +876,17 @@ function import_mail($channel,$mails) {
$m['aid'] = $channel['channel_account_id'];
$m['uid'] = $channel['channel_id'];
- mail_store($m);
+ $mail_id = mail_store($m);
+ if($sync && $mail_id) {
+ proc_run('php','include/notifier.php','single_mail',$mail_id);
+ }
}
}
}
-
+function sync_mail($channel,$mails) {
+ import_mail($channel,$mails,true);
+}
function sync_files($channel,$files) {
diff --git a/include/items.php b/include/items.php
index 014e626b6..7947f64a2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -5616,158 +5616,3 @@ function send_profile_photo_activity($channel,$photo,$profile) {
}
-
-
-
-
-function get_iconfig(&$item, $family, $key) {
-
- $is_item = false;
- if(is_array($item)) {
- $is_item = true;
- if((! array_key_exists('iconfig',$item)) || (! is_array($item['iconfig'])))
- $item['iconfig'] = array();
-
- if(array_key_exists('item_id',$item))
- $iid = $item['item_id'];
- else
- $iid = $item['id'];
- }
- elseif(intval($item))
- $iid = $item;
-
- if(! $iid)
- return false;
-
- if(is_array($item) && array_key_exists('iconfig',$item) && is_array($item['iconfig'])) {
- foreach($item['iconfig'] as $c) {
- if($c['iid'] == $iid && $c['cat'] == $family && $c['k'] == $key)
- return $c['v'];
- }
- }
-
- $r = q("select * from iconfig where iid = %d and cat = '%s' and k = '%s' limit 1",
- intval($iid),
- dbesc($family),
- dbesc($key)
- );
- if($r) {
- $r[0]['v'] = ((preg_match('|^a:[0-9]+:{.*}$|s',$r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']);
- if($is_item)
- $item['iconfig'][] = $r[0];
- return $r[0]['v'];
- }
- return false;
-
-}
-
-/**
- * set_iconfig(&$item, $family, $key, $value, $sharing = false);
- *
- * $item - item array or item id. If passed an array the iconfig meta information is
- * added to the item structure (which will need to be saved with item_store eventually).
- * If passed an id, the DB is updated, but may not be federated and/or cloned.
- * $family - namespace of meta variable
- * $key - key of meta variable
- * $value - value of meta variable
- * $sharing - boolean (default false); if true the meta information is propagated with the item
- * to other sites/channels, mostly useful when $item is an array and has not yet been stored/delivered.
- * If the meta information is added after delivery and you wish it to be shared, it may be necessary to
- * alter the item edited timestamp and invoke the delivery process on the updated item. The edited
- * timestamp needs to be altered in order to trigger an item_store_update() at the receiving end.
- */
-
-
-function set_iconfig(&$item, $family, $key, $value, $sharing = false) {
-
- $dbvalue = ((is_array($value)) ? serialize($value) : $value);
- $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
-
- $is_item = false;
- $idx = null;
-
- if(is_array($item)) {
- $is_item = true;
- if((! array_key_exists('iconfig',$item)) || (! is_array($item['iconfig'])))
- $item['iconfig'] = array();
- elseif($item['iconfig']) {
- for($x = 0; $x < count($item['iconfig']); $x ++) {
- if($item['iconfig'][$x]['cat'] == $family && $item['iconfig'][$x]['k'] == $key) {
- $idx = $x;
- }
- }
- }
- $entry = array('cat' => $family, 'k' => $key, 'v' => $value, 'sharing' => $sharing);
-
- if(is_null($idx))
- $item['iconfig'][] = $entry;
- else
- $item['iconfig'][$idx] = $entry;
- return $value;
- }
-
- if(intval($item))
- $iid = intval($item);
-
- if(! $iid)
- return false;
-
- if(get_iconfig($item, $family, $key) === false) {
- $r = q("insert into iconfig( iid, cat, k, v, sharing ) values ( %d, '%s', '%s', '%s', %d ) ",
- intval($iid),
- dbesc($family),
- dbesc($key),
- dbesc($dbvalue),
- intval($sharing)
- );
- }
- else {
- $r = q("update iconfig set v = '%s', sharing = %d where iid = %d and cat = '%s' and k = '%s' ",
- dbesc($dbvalue),
- intval($sharing),
- intval($iid),
- dbesc($family),
- dbesc($key)
- );
- }
-
- if(! $r)
- return false;
-
- return $value;
-}
-
-
-
-function del_iconfig(&$item, $family, $key) {
-
-
- $is_item = false;
- $idx = null;
-
- if(is_array($item)) {
- $is_item = true;
- if(is_array($item['iconfig'])) {
- for($x = 0; $x < count($item['iconfig']); $x ++) {
- if($item['iconfig'][$x]['cat'] == $family && $item['iconfig'][$x]['k'] == $key) {
- unset($item['iconfig'][$x]);
- }
- }
- }
- return true;
- }
-
- if(intval($item))
- $iid = intval($item);
-
- if(! $iid)
- return false;
-
- return q("delete from iconfig where iid = %d and cat = '%s' and k = '%s' ",
- intval($iid),
- dbesc($family),
- dbesc($key)
- );
-
-}
-
diff --git a/include/network.php b/include/network.php
index ec255581d..395641b73 100644
--- a/include/network.php
+++ b/include/network.php
@@ -2114,8 +2114,9 @@ function check_channelallowed($hash) {
return $retvalue;
}
-function deliverable_singleton($xchan) {
- $r = q("select abook_instance from abook where abook_xchan = '%s' limit 1",
+function deliverable_singleton($channel_id,$xchan) {
+ $r = q("select abook_instance from abook where abook_channel = %d and abook_xchan = '%s' limit 1",
+ intval($channel_id),
dbesc($xchan['xchan_hash'])
);
if($r) {
diff --git a/include/notifier.php b/include/notifier.php
index 4435c7497..f0c6d7275 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -118,7 +118,7 @@ function notifier_run($argv, $argc){
$normal_mode = true;
$packet_type = 'undefined';
- if($cmd === 'mail') {
+ if($cmd === 'mail' || $cmd === 'single_mail') {
$normal_mode = false;
$mail = true;
$private = true;
@@ -280,7 +280,7 @@ function notifier_run($argv, $argc){
logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG);
return;
}
- if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed'])) {
+ if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) || intval($target_item['item_hidden'])) {
logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG);
return;
}
@@ -454,6 +454,7 @@ function notifier_run($argv, $argc){
'uplink' => $uplink,
'cmd' => $cmd,
'mail' => $mail,
+ 'single' => (($cmd === 'single_mail' || $cmd === 'single_activity') ? true : false),
'location' => $location,
'request' => $request,
'normal_mode' => $normal_mode,
@@ -550,6 +551,7 @@ function notifier_run($argv, $argc){
'uplink' => $uplink,
'cmd' => $cmd,
'mail' => $mail,
+ 'single' => (($cmd === 'single_mail' || $cmd === 'single_activity') ? true : false),
'location' => $location,
'request' => $request,
'normal_mode' => $normal_mode,
@@ -568,6 +570,19 @@ function notifier_run($argv, $argc){
}
+ // singleton deliveries by definition 'not got zot'.
+ // Single deliveries are other federated networks (plugins) and we're essentially
+ // delivering only to those that have this site url in their abook_instance
+ // and only from within a sync operation. This means if you post from a clone,
+ // and a connection is connected to one of your other clones; assuming that hub
+ // is running it will receive a sync packet. On receipt of this sync packet it
+ // will invoke a delivery to those connections which are connected to just that
+ // hub instance.
+
+ if($cmd === 'single_mail' || $cmd === 'single_activity') {
+ continue;
+ }
+
// default: zot protocol
$hash = random_string();
diff --git a/include/text.php b/include/text.php
index 0a7f84b01..926e2eed6 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1532,35 +1532,6 @@ function prepare_body(&$item,$attach = false) {
$s = sslify($s);
- // Look for spoiler
- $spoilersearch = '<blockquote class="spoiler">';
-
- // Remove line breaks before the spoiler
- while ((strpos($s, "\n".$spoilersearch) !== false))
- $s = str_replace("\n".$spoilersearch, $spoilersearch, $s);
- while ((strpos($s, "<br />".$spoilersearch) !== false))
- $s = str_replace("<br />".$spoilersearch, $spoilersearch, $s);
-
- while ((strpos($s, $spoilersearch) !== false)) {
-
- $pos = strpos($s, $spoilersearch);
- $rnd = random_string(8);
- $spoilerreplace = '<br /> <span id="spoiler-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'spoiler-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
- '<blockquote class="spoiler" id="spoiler-'.$rnd.'" style="display: none;">';
- $s = substr($s, 0, $pos).$spoilerreplace.substr($s, $pos+strlen($spoilersearch));
- }
-
- // Look for quote with author
- $authorsearch = '<blockquote class="author">';
-
- while ((strpos($s, $authorsearch) !== false)) {
- $pos = strpos($s, $authorsearch);
- $rnd = random_string(8);
- $authorreplace = '<br /> <span id="author-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'author-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
- '<blockquote class="author" id="author-'.$rnd.'" style="display: block;">';
- $s = substr($s, 0, $pos).$authorreplace.substr($s, $pos+strlen($authorsearch));
- }
-
$prep_arr = array(
'item' => $item,
'photo' => $photo,
diff --git a/include/zot.php b/include/zot.php
index 9d9f9ab5f..1ca1b862b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3121,7 +3121,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
import_conv($channel,$arr['conv']);
if(array_key_exists('mail',$arr) && $arr['mail'])
- import_mail($channel,$arr['mail']);
+ sync_mail($channel,$arr['mail']);
if(array_key_exists('event',$arr) && $arr['event'])
sync_events($channel,$arr['event']);