-4

I am sending the following in a IRC bot:

bot->message("chanserv", "op #channel");
bot->raw("KICK #channel " + this->nick(args[0]) + " :RIPIP");
sleep(2000);  // even tried sleepin
bot->message("chanserv", "deop #channel");

I see it sent across the socket

PRIVMSG chanserv :op #channel
KICK #channel baduser :RIPIP
PRIVMSG chanserv :deop #channel
:hobana.freenode.net 482 username #channel :You're not a channel operator

But then it spits back a packet saying you're not an operator, then the op/de-op response packets.

y2k
  • 65,388
  • 27
  • 61
  • 86
  • Please don't spam multiple language tags... – Oliver Charlesworth Jun 11 '13 at 08:19
  • 1
    Sounds like a buffering issue in the server. – Barmar Jun 11 '13 at 08:19
  • I am compiling php into c++ with hiphop and then using embedded python for the plugins – y2k Jun 11 '13 at 08:20
  • Is bot->mesage buffered and bot->raw unbufferred? I'd be *very* surprised if TCP packets are being *sent* out of sequence but even if they are, as long as the data enters the stream in the ocrrect order it will come out in the same order. Have you checked with a packet sniffer? – symcbean Jun 11 '13 at 08:27
  • 1
    Making a bigot of myself, TCP "packets" are not really "send". IP packets are. Maybe out of order. And are reassembled and re-ordered to produced a stream of data on the receiver side. AFAIK, you cannot read "out of order" TCP stream. Are you sure you are using TCP and not UDP here? – Sylvain Leroux Jun 11 '13 at 09:47

1 Answers1

2

This doesn't have anything to do with TCP - it's related to the architecture of IRC. The ChanServ service is not generally part of the client ircd that you are connecting to. It is instead implemented by a seperate ircd that is linked to the client ircd(s).

This means that your KICK (from your client) can arrive at your client server before the mode change message that ops you (from the services daemon) is arriving.

To do this properly, you need to issue the op command to ChanServ, then wait until you see the MODE command giving you ops before issuing the KICK and deop commands.

caf
  • 233,326
  • 40
  • 323
  • 462