示例#1
0
 static function notify($a)
 {
     global $n;
     $engine = new \Inviqa\SkypeEngine($n);
     try {
         $engine->parse($a);
     } catch (Exception $e) {
         echo $e->getMessage() . PHP_EOL;
     }
 }
示例#2
0
 public function testWelcomeMessageIsSentAfterFriendRequestAccepted()
 {
     // mock the dbus object so we can simulate the linux skype client
     $dbus = $this->getMock('DbusObject', array('Invoke'));
     $this->expectSkype($dbus, 0, $this->equalTo('CHAT CREATE xyz,xyz'), 'CHAT xyz NAME');
     $this->expectSkype($dbus, 1, $this->stringStartsWith('CHATMESSAGE xyz'));
     $this->expectSkype($dbus, 2, $this->stringStartsWith('ALTER CHATMEMBER xyz SETROLETO MASTER'));
     $e = new \Inviqa\SkypeEngine($dbus);
     $e->parse('USER xyz BUDDYSTATUS 3');
     // skype api friend status update to accepted
 }
示例#3
0
<?php

require_once 'vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/views'));
$app['skype'] = $app->share(function () {
    return Inviqa\SkypeEngine::getDbusProxy();
});
$app['bot'] = $app->protect(function ($dbus) {
    $bot = new Inviqa\SkypeEngine($dbus);
    return $bot;
});
$app->get('/', function () use($app) {
    return $app['twig']->render('index.twig', array());
});
$app->post('/', function (Request $request) use($app) {
    $username = $request->request->get('username');
    $app['skype']->Invoke("SET USER {$username} ISAUTHORIZED TRUE");
    $app['skype']->Invoke("SET USER {$username} ISBLOCKED FALSE");
    $app['bot']($app['skype'])->parse($app['skype']->Invoke("SET USER {$username} BUDDYSTATUS 2"));
    return $app['twig']->render('thanks.twig', array());
});
$app->run();
示例#4
0
<?php

require_once 'vendor/autoload.php';
if (isset($_REQUEST['payload'])) {
    $payload = json_decode($_REQUEST['payload']);
    if ($payload) {
        $message = array();
        foreach ($payload->commits as $commit) {
            $lines = explode("\n", $commit->message);
            $message[] = '- ' . $lines[0] . ' (' . substr($commit->id, 0, 6) . ')';
        }
        $info = sprintf("%s pushed to %s at %s/%s.\n%s", $payload->head_commit->committer->name, $payload->ref, $payload->repository->organization, $payload->repository->name, join("\n", $message));
        Inviqa\SkypeEngine::getDbusProxy()->Invoke("CHATMESSAGE {$_REQUEST['id']} {$info}");
    }
}