c++botsircident

IRC no ident response (C++)


So, I'm making a bot to monitor my IRC channel, and I can't get it to register ident, I don't know why, here's my code

  int count = 0;
int BeginReceive() {
    do {
        initResult = recv(bobSocket, recvbuf, recvbuflen, 0);

        if (initResult > 0) {
            printf(recvbuf);
            count++;
            std::cout << count << std::endl;
            switch (count) {
            case 2:
                Send("USER jackolalno :hello");
                Send("NICK jackololno");
                break;
            case 3:
                Send("JOIN ##bob");
            default:
                break;
            }
        }
        else if (initResult == 0) {
            printf("Connection closed\n");
        }
        else {
            printf("recv failed: %d\n", WSAGetLastError());
            return 1;
        }
    } while (initResult > 0);
 }

Solution

  • Your USER command is missing values.

    It should contain four parameters of which the second and third may simply be filled with a placeholder, e.g. "*". See: https://www.rfc-editor.org/rfc/rfc1459#section-4.1.3

    You are also not running an ident server on port 113 most likely, but this is optional as per RFC1459.

    Hope this helps!