<commit_before><?php

use Moxl\Xec\Action\Roster\UpdateItem;
use Moxl\Xec\Action\Vcard4\Get;
use Respect\Validation\Validator;
use Moxl\Xec\Action\Pubsub\GetItems;

class Contact extends WidgetBase
{
    private $_paging = 10;

    function load()
    {
        $this->registerEvent('roster_updateitem_handle', 'onContactEdited', 'contacts');
        $this->registerEvent('vcard_get_handle', 'onVcardReceived', 'contacts');
        $this->registerEvent('vcard4_get_handle', 'onVcardReceived', 'contacts');
    }

    public function onVcardReceived($packet)
    {
        $contact = $packet->content;
        $this->ajaxGetContact($contact->jid);
    }

    public function onContactEdited($packet)
    {
        Notification::append(null, $this->__('edit.updated'));
    }

    function ajaxClear($page = 0)
    {
        $html = $this->prepareEmpty($page);
        RPC::call('movim_fill', 'contact_widget', $html);
    }

    function ajaxGetContact($jid, $page = 0)
    {
        if(!$this->validateJid($jid)) return;

        $html = $this->prepareContact($jid);

        Header::fill($header);
        RPC::call('movim_fill', 'contact_widget', $html);
        RPC::call('MovimTpl.showPanel');
        RPC::call('MovimTpl.scrollHeaders');
    }

    function ajaxEditSubmit($form)
    {
        $rd = new UpdateItem;
        $rd->setTo(echapJid($form->jid->value))
           ->setFrom($this->user->getLogin())
           ->setName($form->alias->value)
           ->setGroup($form->group->value)
           ->request();
    }

    function ajaxRefreshFeed($jid)
    {
        if(!$this->validateJid($jid)) return;

        $r = new GetItems;
        $r->setTo($jid)
          ->setNode('urn:xmpp:microblog:0')<commit_msg>Refresh the contact items when requesting the profile<commit_after><?php

use Moxl\Xec\Action\Roster\UpdateItem;
use Moxl\Xec\Action\Vcard4\Get;
use Respect\Validation\Validator;
use Moxl\Xec\Action\Pubsub\GetItems;

class Contact extends WidgetBase
{
    private $_paging = 10;

    function load()
    {
        $this->registerEvent('roster_updateitem_handle', 'onContactEdited', 'contacts');
        $this->registerEvent('vcard_get_handle', 'onVcardReceived', 'contacts');
        $this->registerEvent('vcard4_get_handle', 'onVcardReceived', 'contacts');
    }

    public function onVcardReceived($packet)
    {
        $contact = $packet->content;
        $this->ajaxGetContact($contact->jid);
    }

    public function onContactEdited($packet)
    {
        Notification::append(null, $this->__('edit.updated'));
    }

    function ajaxClear($page = 0)
    {
        $html = $this->prepareEmpty($page);
        RPC::call('movim_fill', 'contact_widget', $html);
    }

    function ajaxGetContact($jid, $page = 0)
    {
        if(!$this->validateJid($jid)) return;

        $html = $this->prepareContact($jid);

        $r = new GetItems;
        $r->setTo($jid)
          ->setNode('urn:xmpp:microblog:0')
          ->request();

        Header::fill($header);
        RPC::call('movim_fill', 'contact_widget', $html);
        RPC::call('MovimTpl.showPanel');
        RPC::call('MovimTpl.scrollHeaders');
    }

    function ajaxEditSubmit($form)
    {
        $rd = new UpdateItem;
        $rd->setTo(echapJid($form->jid->value))
           ->setFrom($this->user->getLogin())
           ->setName($form->alias->value)
           ->setGroup($form->group->value)
           ->request();
    }

    function ajaxRefreshFeed($jid)
    {
        if(!$this->validateJid($jid)) return;

        $r = new GetItems;
        $r->setTo($jid)
          ->setNode('urn:xmpp:microblog:0')
{'fraction_non_alphanumeric': 0.16486561374341924, 'fraction_numerical': 0.004156275976724855, 'mean_word_length': 2.82010582010582, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4642754', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1167, 'n_words': 170}