]> git.mxchange.org Git - friendica.git/blob - src/Module/Contact.php
Remove the activity
[friendica.git] / src / Module / Contact.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2022, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Module;
23
24 use Friendica\BaseModule;
25 use Friendica\Content\ContactSelector;
26 use Friendica\Content\Nav;
27 use Friendica\Content\Pager;
28 use Friendica\Content\Widget;
29 use Friendica\Core\Protocol;
30 use Friendica\Core\Renderer;
31 use Friendica\Core\Theme;
32 use Friendica\Core\Worker;
33 use Friendica\Database\DBA;
34 use Friendica\DI;
35 use Friendica\Model;
36 use Friendica\Model\User;
37 use Friendica\Module\Security\Login;
38 use Friendica\Network\HTTPException\InternalServerErrorException;
39 use Friendica\Network\HTTPException\NotFoundException;
40
41 /**
42  *  Manages and show Contacts and their content
43  */
44 class Contact extends BaseModule
45 {
46         const TAB_CONVERSATIONS = 1;
47         const TAB_POSTS = 2;
48         const TAB_PROFILE = 3;
49         const TAB_CONTACTS = 4;
50         const TAB_ADVANCED = 5;
51         const TAB_MEDIA = 6;
52
53         private static function batchActions()
54         {
55                 if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
56                         return;
57                 }
58
59                 $redirectUrl = $_POST['redirect_url'] ?? 'contact';
60
61                 self::checkFormSecurityTokenRedirectOnError($redirectUrl, 'contact_batch_actions');
62
63                 $orig_records = Model\Contact::selectToArray(['id', 'uid'], ['id' => $_POST['contact_batch'], 'uid' => [0, DI::userSession()->getLocalUserId()], 'self' => false, 'deleted' => false]);
64
65                 $count_actions = 0;
66                 foreach ($orig_records as $orig_record) {
67                         $cdata = Model\Contact::getPublicAndUserContactID($orig_record['id'], DI::userSession()->getLocalUserId());
68                         if (empty($cdata) || DI::userSession()->getPublicContactId() === $cdata['public']) {
69                                 // No action available on your own contact
70                                 continue;
71                         }
72
73                         if (!empty($_POST['contacts_batch_update']) && $cdata['user']) {
74                                 self::updateContactFromPoll($cdata['user']);
75                                 $count_actions++;
76                         }
77
78                         if (!empty($_POST['contacts_batch_block'])) {
79                                 self::toggleBlockContact($cdata['public'], DI::userSession()->getLocalUserId());
80                                 $count_actions++;
81                         }
82
83                         if (!empty($_POST['contacts_batch_ignore'])) {
84                                 self::toggleIgnoreContact($cdata['public']);
85                                 $count_actions++;
86                         }
87                 }
88                 if ($count_actions > 0) {
89                         DI::sysmsg()->addInfo(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
90                 }
91
92                 DI::baseUrl()->redirect($redirectUrl);
93         }
94
95         protected function post(array $request = [])
96         {
97                 if (!DI::userSession()->getLocalUserId()) {
98                         return;
99                 }
100
101                 // @TODO: Replace with parameter from router
102                 if (DI::args()->getArgv()[1] === 'batch') {
103                         self::batchActions();
104                 }
105         }
106
107         /* contact actions */
108
109         /**
110          * @param int $contact_id Id of contact with uid != 0
111          * @throws NotFoundException
112          * @throws \Friendica\Network\HTTPException\InternalServerErrorException
113          * @throws \ImagickException
114          */
115         public static function updateContactFromPoll(int $contact_id)
116         {
117                 $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => DI::userSession()->getLocalUserId(), 'deleted' => false]);
118                 if (!DBA::isResult($contact)) {
119                         return;
120                 }
121
122                 if ($contact['network'] == Protocol::OSTATUS) {
123                         $result = Model\Contact::createFromProbeForUser($contact['uid'], $contact['url'], $contact['network']);
124
125                         if ($result['success']) {
126                                 Model\Contact::update(['subhub' => 1], ['id' => $contact_id]);
127                         }
128
129                         // pull feed and consume it, which should subscribe to the hub.
130                         Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
131                 } else {
132                         Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
133                 }
134         }
135
136         /**
137          * Toggles the blocked status of a contact identified by id.
138          *
139          * @param int $contact_id Id of the contact with uid = 0
140          * @param int $owner_id   Id of the user we want to block the contact for
141          * @throws \Exception
142          */
143         private static function toggleBlockContact(int $contact_id, int $owner_id)
144         {
145                 $blocked = !Model\Contact\User::isBlocked($contact_id, $owner_id);
146                 Model\Contact\User::setBlocked($contact_id, $owner_id, $blocked);
147         }
148
149         /**
150          * Toggles the ignored status of a contact identified by id.
151          *
152          * @param int $contact_id Id of the contact with uid = 0
153          * @throws \Exception
154          */
155         private static function toggleIgnoreContact(int $contact_id)
156         {
157                 $ignored = !Model\Contact\User::isIgnored($contact_id, DI::userSession()->getLocalUserId());
158                 Model\Contact\User::setIgnored($contact_id, DI::userSession()->getLocalUserId(), $ignored);
159         }
160
161         protected function content(array $request = []): string
162         {
163                 if (!DI::userSession()->getLocalUserId()) {
164                         return Login::form($_SERVER['REQUEST_URI']);
165                 }
166
167                 $search = trim($_GET['search'] ?? '');
168                 $nets   = trim($_GET['nets']   ?? '');
169                 $rel    = trim($_GET['rel']    ?? '');
170                 $group  = trim($_GET['group']  ?? '');
171
172                 $accounttype = $_GET['accounttype'] ?? '';
173                 $accounttypeid = User::getAccountTypeByString($accounttype);
174
175                 $page = DI::page();
176
177                 $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
178                 $page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
179                 $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
180                 $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
181
182                 $vcard_widget = '';
183                 $findpeople_widget = Widget::findPeople();
184                 if (isset($_GET['add'])) {
185                         $follow_widget = Widget::follow($_GET['add']);
186                 } else {
187                         $follow_widget = Widget::follow();
188                 }
189
190                 $account_widget = Widget::accountTypes($_SERVER['REQUEST_URI'], $accounttype);
191                 $networks_widget = Widget::networks($_SERVER['REQUEST_URI'], $nets);
192                 $rel_widget = Widget::contactRels($_SERVER['REQUEST_URI'], $rel);
193                 $groups_widget = Widget::groups($_SERVER['REQUEST_URI'], $group);
194
195                 DI::page()['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $rel_widget . $groups_widget . $networks_widget . $account_widget;
196
197                 $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
198                 DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
199                         '$baseurl' => DI::baseUrl()->get(true),
200                 ]);
201
202                 $o = '';
203                 Nav::setSelected('contact');
204
205                 $_SESSION['return_path'] = DI::args()->getQueryString();
206
207                 $sql_values = [DI::userSession()->getLocalUserId()];
208
209                 // @TODO: Replace with parameter from router
210                 $type = DI::args()->getArgv()[1] ?? '';
211
212                 switch ($type) {
213                         case 'blocked':
214                                 $sql_extra = " AND `id` IN (SELECT `cid` FROM `user-contact` WHERE `user-contact`.`uid` = ? AND `user-contact`.`blocked`)";
215                                 // This makes the query look for contact.uid = 0
216                                 array_unshift($sql_values, 0);
217                                 break;
218                         case 'hidden':
219                                 $sql_extra = " AND `hidden` AND NOT `blocked` AND NOT `pending`";
220                                 break;
221                         case 'ignored':
222                                 $sql_extra = " AND `id` IN (SELECT `cid` FROM `user-contact` WHERE `user-contact`.`uid` = ? AND `user-contact`.`ignored`)";
223                                 // This makes the query look for contact.uid = 0
224                                 array_unshift($sql_values, 0);
225                                 break;
226                         case 'archived':
227                                 $sql_extra = " AND `archive` AND NOT `blocked` AND NOT `pending`";
228                                 break;
229                         case 'pending':
230                                 $sql_extra = " AND `pending` AND NOT `archive` AND NOT `failed` AND ((`rel` = ?)
231                                         OR `id` IN (SELECT `contact-id` FROM `intro` WHERE `intro`.`uid` = ? AND NOT `ignore`))";
232                                 $sql_values[] = Model\Contact::SHARING;
233                                 $sql_values[] = DI::userSession()->getLocalUserId();
234                                 break;
235                         default:
236                                 $sql_extra = " AND NOT `archive` AND NOT `blocked` AND NOT `pending`";
237                                 break;
238                 }
239
240                 if (isset($accounttypeid)) {
241                         $sql_extra .= " AND `contact-type` = ?";
242                         $sql_values[] = $accounttypeid;
243                 }
244
245                 $searching = false;
246                 $search_hdr = null;
247                 if ($search) {
248                         $searching = true;
249                         $search_hdr = $search;
250                         $search_txt = preg_quote(trim($search, ' @!'));
251                         $sql_extra .= " AND (`name` REGEXP ? OR `url` REGEXP ? OR `nick` REGEXP ? OR `addr` REGEXP ? OR `alias` REGEXP ?)";
252                         $sql_values[] = $search_txt;
253                         $sql_values[] = $search_txt;
254                         $sql_values[] = $search_txt;
255                         $sql_values[] = $search_txt;
256                         $sql_values[] = $search_txt;
257                 }
258
259                 if ($nets) {
260                         $sql_extra .= " AND network = ? ";
261                         $sql_values[] = $nets;
262                 }
263
264                 switch ($rel) {
265                         case 'followers':
266                                 $sql_extra .= " AND `rel` IN (?, ?)";
267                                 $sql_values[] = Model\Contact::FOLLOWER;
268                                 $sql_values[] = Model\Contact::FRIEND;
269                                 break;
270                         case 'following':
271                                 $sql_extra .= " AND `rel` IN (?, ?)";
272                                 $sql_values[] = Model\Contact::SHARING;
273                                 $sql_values[] = Model\Contact::FRIEND;
274                                 break;
275                         case 'mutuals':
276                                 $sql_extra .= " AND `rel` = ?";
277                                 $sql_values[] = Model\Contact::FRIEND;
278                                 break;
279                 }
280
281                 if ($group) {
282                         $sql_extra .= " AND `id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)";
283                         $sql_values[] = $group;
284                 }
285
286                 $networks = Widget::unavailableNetworks();
287                 $sql_extra .= " AND NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")";
288                 $sql_values = array_merge($sql_values, $networks);
289
290                 $condition = ["`uid` = ? AND NOT `self` AND NOT `deleted`" . $sql_extra];
291                 $condition = array_merge($condition, $sql_values);
292
293                 $total = DBA::count('contact', $condition);
294
295                 $pager = new Pager(DI::l10n(), DI::args()->getQueryString());
296
297                 $contacts = [];
298
299                 $stmt = DBA::select('contact', [], $condition, ['order' => ['name'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]]);
300
301                 while ($contact = DBA::fetch($stmt)) {
302                         $contact['blocked'] = Model\Contact\User::isBlocked($contact['id'], DI::userSession()->getLocalUserId());
303                         $contact['readonly'] = Model\Contact\User::isIgnored($contact['id'], DI::userSession()->getLocalUserId());
304                         $contacts[] = self::getContactTemplateVars($contact);
305                 }
306                 DBA::close($stmt);
307
308                 $tabs = [
309                         [
310                                 'label' => DI::l10n()->t('All Contacts'),
311                                 'url'   => 'contact',
312                                 'sel'   => !$type ? 'active' : '',
313                                 'title' => DI::l10n()->t('Show all contacts'),
314                                 'id'    => 'showall-tab',
315                                 'accesskey' => 'l',
316                         ],
317                         [
318                                 'label' => DI::l10n()->t('Pending'),
319                                 'url'   => 'contact/pending',
320                                 'sel'   => $type == 'pending' ? 'active' : '',
321                                 'title' => DI::l10n()->t('Only show pending contacts'),
322                                 'id'    => 'showpending-tab',
323                                 'accesskey' => 'p',
324                         ],
325                         [
326                                 'label' => DI::l10n()->t('Blocked'),
327                                 'url'   => 'contact/blocked',
328                                 'sel'   => $type == 'blocked' ? 'active' : '',
329                                 'title' => DI::l10n()->t('Only show blocked contacts'),
330                                 'id'    => 'showblocked-tab',
331                                 'accesskey' => 'b',
332                         ],
333                         [
334                                 'label' => DI::l10n()->t('Ignored'),
335                                 'url'   => 'contact/ignored',
336                                 'sel'   => $type == 'ignored' ? 'active' : '',
337                                 'title' => DI::l10n()->t('Only show ignored contacts'),
338                                 'id'    => 'showignored-tab',
339                                 'accesskey' => 'i',
340                         ],
341                         [
342                                 'label' => DI::l10n()->t('Archived'),
343                                 'url'   => 'contact/archived',
344                                 'sel'   => $type == 'archived' ? 'active' : '',
345                                 'title' => DI::l10n()->t('Only show archived contacts'),
346                                 'id'    => 'showarchived-tab',
347                                 'accesskey' => 'y',
348                         ],
349                         [
350                                 'label' => DI::l10n()->t('Hidden'),
351                                 'url'   => 'contact/hidden',
352                                 'sel'   => $type == 'hidden' ? 'active' : '',
353                                 'title' => DI::l10n()->t('Only show hidden contacts'),
354                                 'id'    => 'showhidden-tab',
355                                 'accesskey' => 'h',
356                         ],
357                         [
358                                 'label' => DI::l10n()->t('Groups'),
359                                 'url'   => 'group',
360                                 'sel'   => '',
361                                 'title' => DI::l10n()->t('Organize your contact groups'),
362                                 'id'    => 'contactgroups-tab',
363                                 'accesskey' => 'e',
364                         ],
365                 ];
366
367                 $tabs_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
368                 $tabs_html = Renderer::replaceMacros($tabs_tpl, ['$tabs' => $tabs]);
369
370                 switch ($rel) {
371                         case 'followers': $header = DI::l10n()->t('Followers'); break;
372                         case 'following': $header = DI::l10n()->t('Following'); break;
373                         case 'mutuals':   $header = DI::l10n()->t('Mutual friends'); break;
374                         default:          $header = DI::l10n()->t('Contacts');
375                 }
376
377                 switch ($type) {
378                         case 'pending':  $header .= ' - ' . DI::l10n()->t('Pending'); break;
379                         case 'blocked':  $header .= ' - ' . DI::l10n()->t('Blocked'); break;
380                         case 'hidden':   $header .= ' - ' . DI::l10n()->t('Hidden'); break;
381                         case 'ignored':  $header .= ' - ' . DI::l10n()->t('Ignored'); break;
382                         case 'archived': $header .= ' - ' . DI::l10n()->t('Archived'); break;
383                 }
384
385                 $header .= $nets ? ' - ' . ContactSelector::networkToName($nets) : '';
386
387                 $tpl = Renderer::getMarkupTemplate('contacts-template.tpl');
388                 $o .= Renderer::replaceMacros($tpl, [
389                         '$header'     => $header,
390                         '$tabs'       => $tabs_html,
391                         '$total'      => $total,
392                         '$search'     => $search_hdr,
393                         '$desc'       => DI::l10n()->t('Search your contacts'),
394                         '$finding'    => $searching ? DI::l10n()->t('Results for: %s', $search) : '',
395                         '$submit'     => DI::l10n()->t('Find'),
396                         '$cmd'        => DI::args()->getCommand(),
397                         '$contacts'   => $contacts,
398                         '$form_security_token'  => BaseModule::getFormSecurityToken('contact_batch_actions'),
399                         'multiselect' => 1,
400                         '$batch_actions' => [
401                                 'contacts_batch_update'  => DI::l10n()->t('Update'),
402                                 'contacts_batch_block'   => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'),
403                                 'contacts_batch_ignore'  => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'),
404                         ],
405                         '$h_batch_actions' => DI::l10n()->t('Batch Actions'),
406                         '$paginate'   => $pager->renderFull($total),
407                 ]);
408
409                 return $o;
410         }
411
412         /**
413          * List of pages for the Contact TabBar
414          *
415          * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
416          *
417          * @param array $contact    The contact array
418          * @param int   $active_tab 1 if tab should be marked as active
419          *
420          * @return string HTML string of the contact page tabs buttons.
421          * @throws \Friendica\Network\HTTPException\InternalServerErrorException
422          * @throws \ImagickException
423          */
424         public static function getTabsHTML(array $contact, int $active_tab)
425         {
426                 $cid = $pcid = $contact['id'];
427                 $data = Model\Contact::getPublicAndUserContactID($contact['id'], DI::userSession()->getLocalUserId());
428                 if (!empty($data['user']) && ($contact['id'] == $data['public'])) {
429                         $cid = $data['user'];
430                 } elseif (!empty($data['public'])) {
431                         $pcid = $data['public'];
432                 }
433
434                 // tabs
435                 $tabs = [
436                         [
437                                 'label' => DI::l10n()->t('Status'),
438                                 'url'   => 'contact/' . $pcid . '/conversations',
439                                 'sel'   => (($active_tab == self::TAB_CONVERSATIONS) ? 'active' : ''),
440                                 'title' => DI::l10n()->t('Conversations started by this contact'),
441                                 'id'    => 'status-tab',
442                                 'accesskey' => 'm',
443                         ],
444                         [
445                                 'label' => DI::l10n()->t('Posts and Comments'),
446                                 'url'   => 'contact/' . $pcid . '/posts',
447                                 'sel'   => (($active_tab == self::TAB_POSTS) ? 'active' : ''),
448                                 'title' => DI::l10n()->t('Status Messages and Posts'),
449                                 'id'    => 'posts-tab',
450                                 'accesskey' => 'p',
451                         ],
452                         [
453                                 'label' => DI::l10n()->t('Media'),
454                                 'url'   => 'contact/' . $pcid . '/media',
455                                 'sel'   => (($active_tab == self::TAB_MEDIA) ? 'active' : ''),
456                                 'title' => DI::l10n()->t('Posts containing media objects'),
457                                 'id'    => 'media-tab',
458                                 'accesskey' => 'd',
459                         ],
460                         [
461                                 'label' => DI::l10n()->t('Profile'),
462                                 'url'   => 'contact/' . $cid,
463                                 'sel'   => (($active_tab == self::TAB_PROFILE) ? 'active' : ''),
464                                 'title' => DI::l10n()->t('Profile Details'),
465                                 'id'    => 'profile-tab',
466                                 'accesskey' => 'o',
467                         ],
468                         ['label' => DI::l10n()->t('Contacts'),
469                                 'url'   => 'contact/' . $pcid . '/contacts',
470                                 'sel'   => (($active_tab == self::TAB_CONTACTS) ? 'active' : ''),
471                                 'title' => DI::l10n()->t('View all known contacts'),
472                                 'id'    => 'contacts-tab',
473                                 'accesskey' => 't'
474                         ],
475                 ];
476
477                 if (!empty($contact['network']) && in_array($contact['network'], [Protocol::FEED, Protocol::MAIL]) && ($cid != $pcid)) {
478                         $tabs[] = ['label' => DI::l10n()->t('Advanced'),
479                                 'url'   => 'contact/' . $cid . '/advanced/',
480                                 'sel'   => (($active_tab == self::TAB_ADVANCED) ? 'active' : ''),
481                                 'title' => DI::l10n()->t('Advanced Contact Settings'),
482                                 'id'    => 'advanced-tab',
483                                 'accesskey' => 'r'
484                         ];
485                 }
486
487                 $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
488                 $tab_str = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
489
490                 return $tab_str;
491         }
492
493         /**
494          * Return the fields for the contact template
495          *
496          * @param array $contact Contact array
497          * @return array Template fields
498          * @throws InternalServerErrorException
499          * @throws \ImagickException
500          */
501         public static function getContactTemplateVars(array $contact): array
502         {
503                 $alt_text = '';
504
505                 if (!empty($contact['url']) && isset($contact['uid']) && ($contact['uid'] == 0) && DI::userSession()->getLocalUserId()) {
506                         $personal = Model\Contact::getByURL($contact['url'], false, ['uid', 'rel', 'self'], DI::userSession()->getLocalUserId());
507                         if (!empty($personal)) {
508                                 $contact['uid']  = $personal['uid'];
509                                 $contact['rel']  = $personal['rel'];
510                                 $contact['self'] = $personal['self'];
511                         }
512                 }
513
514                 if (!empty($contact['uid']) && !empty($contact['rel']) && DI::userSession()->getLocalUserId() == $contact['uid']) {
515                         switch ($contact['rel']) {
516                                 case Model\Contact::FRIEND:
517                                         $alt_text = DI::l10n()->t('Mutual Friendship');
518                                         break;
519
520                                 case Model\Contact::FOLLOWER;
521                                         $alt_text = DI::l10n()->t('is a fan of yours');
522                                         break;
523
524                                 case Model\Contact::SHARING;
525                                         $alt_text = DI::l10n()->t('you are a fan of');
526                                         break;
527
528                                 default:
529                                         break;
530                         }
531                 }
532
533                 $url = Model\Contact::magicLinkByContact($contact);
534
535                 if (strpos($url, 'contact/redir/') === 0) {
536                         $sparkle = ' class="sparkle" ';
537                 } else {
538                         $sparkle = '';
539                 }
540
541                 if ($contact['pending']) {
542                         if (in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) {
543                                 $alt_text = DI::l10n()->t('Pending outgoing contact request');
544                         } else {
545                                 $alt_text = DI::l10n()->t('Pending incoming contact request');
546                         }
547                 }
548
549                 if ($contact['self']) {
550                         $alt_text = DI::l10n()->t('This is you');
551                         $url      = $contact['url'];
552                         $sparkle  = '';
553                 }
554
555                 return [
556                         'id'           => $contact['id'],
557                         'url'          => $url,
558                         'img_hover'    => DI::l10n()->t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']),
559                         'photo_menu'   => Model\Contact::photoMenu($contact, DI::userSession()->getLocalUserId()),
560                         'thumb'        => Model\Contact::getThumb($contact, true),
561                         'alt_text'     => $alt_text,
562                         'name'         => $contact['name'],
563                         'nick'         => $contact['nick'],
564                         'details'      => $contact['location'],
565                         'tags'         => $contact['keywords'],
566                         'about'        => $contact['about'],
567                         'account_type' => Model\Contact::getAccountType($contact['contact-type']),
568                         'sparkle'      => $sparkle,
569                         'itemurl'      => ($contact['addr'] ?? '') ?: $contact['url'],
570                         'network'      => ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol'], $contact['gsid']),
571                 ];
572         }
573 }