Exemplo n.º 1
0
 /**
  * @return $this
  */
 public function connect()
 {
     $proto = $this->config->getSsl() ? 'ssl://' : 'tcp://';
     if (!($this->socket = @fsockopen($proto . $this->config->getHost(), $this->config->getPort(), $errno, $errstr))) {
         throw new SocketErrorException($errstr, $errno);
     }
     stream_set_blocking($this->socket, 0);
     // Set socket in non-blocking mode
     if ($this->config->getPass()) {
         $this->send(sprintf('PASS %s', $this->config->getPass()));
     }
     $this->send(sprintf('NICK %s', $this->config->getNick()));
     $this->send(sprintf('USER %s 0 %s :%s', $this->config->getUser(), $this->config->getHost(), $this->config->getReal()));
     return $this;
 }
Exemplo n.º 2
0
<?php

require 'vendor/autoload.php';
use Zoddo\irc\Config as IrcConfig;
use Zoddo\gitlab\irc\Config;
use Zoddo\gitlab\irc\EventListener;
use Zoddo\gitlab\webhook\Event;
$ircConfig = new IrcConfig('irc.ekinetirc.fr.nf', 'GitLab');
$ircConfig->setPort(6697)->setSsl();
$config = new Config($ircConfig, '#Zoddo');
$event = new Event(file_get_contents("php://input"));
$event->addEventListener(new EventListener($config));
if ($event->gettype() !== null) {
    $event->execEvent();
}