Skip to content

Simple cross-platform console IRC Client written in C++

License

Notifications You must be signed in to change notification settings

aeshmann/IRCClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple cross-platform Console IRC Client

Windows Linux Azure (Linux/macOS)
Windows Build status Linux Build Status Azure Build Status (Linux/macOS)
  • It works on windows and linux (haven't tested on mac)
  • Can be used as an IRC bot
  • It has a simple hook system where you can do whatever you want when receiving an IRC command.
  • Example in Main.cpp

Connecting to IRC:

There are two ways to connect:

  1. with commanl line arguments: ./ircxx host port nick user password auto // if auto provided, client connects with no connection parameters confirmation

    ./ircxx your.znc.host 7755 your_nick your_username@ZNC_client_identfier/ZNC_Network_name ZNC_password auto // connects to host (ZNC) with nick aion, ident xion, identifier ircxx, password lamodrom, no confirmation (auto)

    ./ircxx irc.rizon.net 7000 zima xion nopass auto // connects automatically with nick zima, username xion, no confirmation

    ./ircxx irc.rizon.net 7000 zima xion // connects with confirmation, nick=zima, ident=xion, asks confirmation to connect

    Not public samples:

     ./ircxx host port nick user password auto // if auto provided, client connects with no connection parameters confirmation
    
     ./ircxx 45.155.205.106 7788 aion xion@ircxx/rusnet -password- auto // connects to host (ZNC) with nick aion, ident xion, identifier ircxx, password -password-, no confirmation (auto)
    
     ./ircxx irc.rizon.net 7000 zima xion nopass auto // connects automatically with no confirmation
    
     ./ircxx irc.rizon.net 7000 zima xion // connects with confirmation, nick=zima, ident=xion
    
  2. with connection parameters, read from irc.conf file

    Config file should be named irc.conf. Config file samples are licated in set/ folder.

Hooking IRC commands:

First create a function (name it whatever you want) with two arguments, an IRCMessage and a pointer to IRCClient:

void onPrivMsg(IRCMessage message, IRCClient* client)
{
    // Check who can "control" us
    if (message.prefix.nick != "YourNick")
        return;
    
    // received text
    std::string text = message.parameters.at(message.parameters.size() - 1);
    
    if (text == "join #channel")
        client->SendIRC("JOIN #channel");
    if (text == "leave #channel")
        client->SendIRC("PART #channel");
    if (text == "quit now")
        client->SendIRC("QUIT");
}

Then, after you create the IRCClient instance, you can hook it:

IRCClient client;

// Hook PRIVMSG
client.HookIRCCommand("PRIVMSG", &onPrivMsg);

Building on windows with Mingw:

  • Edit Makefile
  • Replace "-lpthread" with "-lws2_32" (no quotes) in LDFLAGS on line 3.
  • Add ".exe" extension (no quotes) to the EXECUTABLE filename (line 8).

Contribution

Just send a pull request! :)

GNU LGPL

IRCClient is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

http://www.gnu.org/licenses/lgpl.html

About

Simple cross-platform console IRC Client written in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.8%
  • Makefile 1.2%