@@ 101-114 (lines=14) @@ | ||
98 | /** |
|
99 | * @param GitterRoom $room |
|
100 | */ |
|
101 | public function syncMessages(GitterRoom $room) |
|
102 | { |
|
103 | /** @var CircleProgress $circle */ |
|
104 | $this->output->writeln('Fetching...'); |
|
105 | ||
106 | $room->getMessages() |
|
107 | // Fetch all messages |
|
108 | ->fetch(function (GitterMessage $message, Controls $controls) { |
|
109 | $this->messageRemember($message, $controls); |
|
110 | }) |
|
111 | ->then(function () use ($room) { |
|
112 | $this->syncLatestMessages($room); |
|
113 | }); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * @param GitterMessage $gitterMessage |
@@ 151-161 (lines=11) @@ | ||
148 | ->first(); |
|
149 | ||
150 | if ($lastMessage) { |
|
151 | $loop->addTimer($timeout, function () use ($gitter, $lastMessage) { |
|
152 | $gitter |
|
153 | ->getMessages($lastMessage->gitter_id, GitterRoom::MESSAGE_FETCH_ASC) |
|
154 | ->fetch(function (GitterMessage $message, Controls $controls) { |
|
155 | $this->onMessage($message); |
|
156 | $controls->next(); |
|
157 | }) |
|
158 | ->then(function () use ($gitter) { |
|
159 | $this->warn('Connection...'); |
|
160 | $this->listen($gitter); |
|
161 | }); |
|
162 | }); |
|
163 | } else { |
|
164 | $this->listen($gitter); |