diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 4c3ebcc47..d09427e75 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -257,6 +257,16 @@ function jappixmini_settings(&$a, &$s) { $info_text = htmlentities($info_text); $info_text = str_replace("\n", "
", $info_text); + // count contacts + $r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%'", local_user()); + if (count($r)) $contact_cnt = $r[0]["cnt"]; + else $contact_cnt = 0; + + // count jabber addresses + $r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%' AND `v` LIKE '%%@%%'", local_user()); + if (count($r)) $address_cnt = $r[0]["cnt"]; + else $address_cnt = 0; + if (!$activate) { // load scripts if not yet activated so that password can be saved $a->page['htmlhead'] .= ''."\r\n"; @@ -304,6 +314,7 @@ function jappixmini_settings(&$a, &$s) { $s .= ' '; $s .= '
'; if ($info_text) $s .= '
Configuration help:

'.$info_text.'

'; + $s .= '
Status:

Addon knows '.$address_cnt.' Jabber addresses of '.$contact_cnt.' Friendica contacts (takes some time, usually 10 minutes, to update).

'; $s .= ''; $s .= ' '; $s .= ''; @@ -390,7 +401,7 @@ function jappixmini_settings_post(&$a,&$b) { info( 'Jappix Mini settings saved.' ); if ($purge) { - q("DELETE FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' and `k` LIKE 'id%%'"); + q("DELETE FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'"); info( 'List of addresses purged.' ); } } @@ -438,7 +449,7 @@ function jappixmini_script(&$a,&$s) { // get a list of jabber accounts of the contacts $contacts = Array(); $uid = local_user(); - $rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' and `k` LIKE 'id%%'"); + $rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'"); foreach ($rows as $row) { $key = $row['k']; $pos = strpos($key, ":");