HydraIRC
Written and designed by Dominic Clifton.
More complete docs to come, but here's a few things you might want to know...
Contents
Due to popular demand I've added a *temporary* solution to the autoconnect
and autologin stuff that has been requested.
Please read this bit carefully!
HydraIRC will execute a command profile called "OnStartup" when it starts also,
when HydraIRC connects to a server it tries to match up the server to a server
in the server list, if it then finds a matching server name it then determines
the network that the server belongs to. Once the network has been determined
HydraIRC will then execute the command profile called
"<Network>_OnLoggedIn" when you are logged in to the server, then it will
execute one called "<ServerName>_OnLoggedIn". Additionally, HydraIRC will
run command profiles called "<Network>_<Channel>_OnJoin" when you
join a channel.
Example command profile names and contents.
OnStartup
/server irc.quakenet.org
/newserver irc.efnet.pl
QuakeNet_OnLoggedIn
/join #ctfpickup.euro,#quake3,#bygames
/qauth MyName MyPassword
irc.barrysworld.com_OnLoggedIn
/join #cs
EFNet_OnLoggedIn
/join #hydrairc
/msg #hydrairc I'm a noobie HydraIRC user!
EFNet_#HydraIRC_OnJoin
/msg Hydra I love your IRC Client!
Hello everyone
/mode -o Rovastar
Note: this is a temporary solution, at a later date you will be able to
assign command profiles to networks and select which networks to connect to
when the application starts, but this will do for now.
Noobie note: your server name must appear somewhere in the connect
dialog box's server and network list for <Network>_OnLoggedIn to work
and the network names must match!
HydraIRC lets you configure not 1, not 2 but as many alternate nicks as you like, to guarantee that you'll get connected to the server.
You can use the Tools/Options/Identities dialog to change your user identities, user identities must have a list of nicks associated with them.
When you first connect to a server HydraIRC will use the first nick in the chosen identity's list of nicks, if that is taken then it will try the next one in the list and so on. If it's still not found an unused nick then HydraIRC will add a numerical prefix to your preferred nick (in square brackets) and will keep incrementing the number until a free nick is found. If you get disconnected for any reason (ping timeout, etc..) then HydraIRC will then reconnect using the nick you were last using. If that is taken then HydraIRC will restart the process of nick selection again. It performs this procedure for every subsequent re-connect attempt.
Example:
You have 2 nicks, "MyName" and "My_Name".
Upon connection for the first time it will try and use "MyName", but that nick was in-use so HydraIRC tried "My_Name" instead and connects ok. For some reason you get disconnected, so HydraIRC reconnects and uses the last nick used, which in this example was "My_Name", but that nick is still taken because the server hasn't figured out that you've timed out yet. So HydraIRC tries "MyName" again, but that's still taken, so it then tries "My_Name" again (because it's second in the list), but this is still in use, so then HydraIRC tries to connect with "[1]MyName" and connects successfully. If you were to get disconnected again, then HydraIRC would try "[1]MyName" again (because that's what it was using last), then "MyName", "My_Name", "[1]MyName", "[2]MyName", "[3]MyName" and so on...
Now just how cool is that? :)
Note: in contrast most clients always re-connect with your first nick, then your alternate nick and then stop. This can be really annoying if you had queued up a file on an fserve that sends the file to the nick of the user that queued it. If you changed your nick and then queued a file, then your client reconnected using a different nick you would not be sent the file. In addition most clients don't allow you to specify nicks on a per server/network basis, and some even do, but then forget them and just use the last used nick when reconnecting to a server, even on on a different network! (Trillian for example..)
Again, as you can see HydraIRC kicks ass.
Note: future releases will also try and obtain your preferred nick (or last used nick) after a re-connect with a temporary alternate nick.
DCC sending when behind a router/firewall
When connecting to an IRC server, HydraIRC will look at the welcome message and extract the DNS/Host information from the message (if present).
Also, if you do a /whois on yourself and the server supports the 338 or 378 numeric replies, the host information will be extracted from the reply.
The extracted string will then be used for DCC sending unless you set a value for "Router Address" in the prefs, thus giving you the option of being able to override the address that HydraIRC uses.
The extracted string or Router Address setting is passed to other users when you initialise a DCC SEND (not receive) so they know what IP/Port to connect to.
If you are behind a firewall and your machine is NOT the firewall AND you only connect to servers from which HydraIRC cannot determine your external address (e.g. a local server on your lan) AND you need to SEND files to people OUTSIDE your LAN then you should specify the EXTERNAL ip address of your router and configure it to forward the usual dcc ports to your machine's LAN address. ;) (Read that twice)
Basically, set the Router Address option in prefs if you have problems, leave it blank otherwise.
You still need to configure your router/firewall so that it forwards the ports to your machines correctly however.
e.g.
Router: 192.168.0.1, Internet Address: 62.1.23.45
PC1: 192.168.0.2
PC2: 192.168.0.3
On PC1, you would use dcc ports 3072-3171
On PC2, you would use dcc ports 3172-3271
On the router you configure port forwarding so that it forwards incoming tcp packets bound for ports 3072-3171 to 192.168.0.1 (PC1) and then configure it to forward incoming tcp packets bound for ports 3172-3271 to 192.168.0.2 (PC2)
Then any packets heading to 62.1.23.45:3072-3171 are forwarded to PC1 and any packets heading to 62.1.23.45:3172-3271 are forwarded to PC2.
In HydraIRC you would need to set the "Router Address" option to "62.1.23.45" (or you can use the FQDN of the Router's external interface if you like. e.g "host1343.location.isp.co.uk")
You can use the options "DCC Send First Port" and "DCC Send Last Port" in HydraIRC to configure the port ranges for the PC's
e.g.
on PC1 you would set "DCC Send First Port" to "3072" and "DCC Send Last Port"
to "3171"
on PC2 you would set "DCC Send First Port" to "3172" and "DCC Send Last Port"
to "3271"
"Ctrl+K<fgcolor>[,<bgcolor>]text" - sets foreground (text) color, and optionally sets background color
So, "Ctrl+K8,7yellow on orange" would be displayed as "yellow on orange"
"Ctrl+M<fg-hi-color>[<bg-hi-color>]text" - sets forground (text) color, and optionally sets background color, using hex 8bpp RGB color values. e.g. white = 0xFFFFFF, red = 0xFF0000, green = 0x00ff00, blue = 0x0000FF. So yellow on orange would be: "Ctrl+MFFFF00,FF7F00yellow on orange".
Note: This method, of color changing is not supported by many clients and takes up (max) 14 characters to change the fg and bg colors, the IRC protocol has a limit of max 512 characters per line, channel line limits will be less. For this reason it is not advisable to change color using this method two many times on one line, if the data is being sent via the server, if it's just for a local echo, you've got no worries. Bersirc supports this mode, not sure about other clients yet.
The advantage is that the color will always be displayed the same on any client that supports it. User's can remap the normal 16 colors to be different colors. e.g. 8 = yellow, but it might not be displayed as yellow, or it might be a slightly different shade of yellow.
To work out these values, use a color picker in any decent paint program and convert the HTML color value to decimal using a calculator (calc.exe for instance).
Ctrl+R - Reverses background and forground colors.
Ctrl+U - Toggle underline
Ctrl+B - Toggle bold
Ctrl+N - Toggle Italic
Ctrl+O - Reset to normal background and foreground colors. So, if your normal background is black, and your normal text is white, then this sequence "normalCtrl+Knormal" would appear as "normalnormal". If however you have the much nicer looking defaults of black text on a white background, the sequence would appear as "normalnormal".
Some clients do not handle Ctrl+O correctly and reset the colors to white text on a black background, rather than using your normal colors. So, some clients would display the sequence above as "normalnormal" which is incorrect.
mIRC does not handle italics.
The sequence "normalCtrl+BCtrl+UCtrl+Nbold italic underlineCtrl+Bitalic underlineCtrl+NCtrl+Bbold underlineCtrl+UCtrl+Nitalic boldCtrl+NboldCtrl+BCtrl+NitalicCtrl+NCtrl+UunderlineCtrl+Unormal" should appear as "normalbold italic underlineitalic underlinebold underlineitalic boldbolditalicunderlinenormal"
"Ctrl+K8,7yellow on orangeCtrl+Rorange on yellow" = "yellow on orangeorange on yellow"
Note: mIRC does not handle ctrl+r correctly, the same text would appear as "yellow on orangeorange on yellow" Yes, it's offical, mirc sucks ass.
Note: Bersirc does not handle ctrl+r correctly either, this control string "normalCtrl+RreverseCtrl+K8yellow on black" appears like this: "normalreverseyellow on black", Yes, it's offical, Bersirc sucks too, but not as much is mIRC.
HydraIRC handles it correctly: "normalreverseyellow on black" (if your normal text colors were black on white, or "normalreverseyellow on black" if your normal colors were white on black, note that this shows up why you must set text and background colors. If you want white or black to appear as white or back on ALL clients, regardless of their default colors. you would use this: "Ctrl+K1,0normalCtrl+K0,1reverseCtrl+K8,1yellow on black"
The use of Ctrl+R should be avoided as it's interpretation is flawed on most clients.
There is also another issue with some clients because the idiot who though up the color code numbers didn't think about their parse routines. Most clients can't display "10" and end up displaying "0" instead, what you say ? Yeah, I know, crap huh.. "Why?" you ask.. Well, if you remember that "Ctrl+K410" is the correct sequence, most clients try and interpret "41" as the color number, which of course is not a valid color number, so they ignore the "Ctrl+K" and the bad number and then just display the "0". /me *Sighs*
If you want to display a number directly after a color change on all clients, tough luck, you'll have to add a space. e.g. "Ctrl+K4 10" which appears as " 10".
HydraIRC of course figures out that 41 isn't a valid color number, and then think, oh, but 4 is.. And then displays the correct output. HydraIRC also supports 2 digit color numbers that have a leading 0, e.g. "Ctrl+K04,0510" displays "10"
Here are the correct color definitions
0 - white(white)
1 - black
2 - darkblue
3 - darkgreen
4 - red
5 - brown
6 - purple
7 - orange
8 - yellow
9 - green
10 - darkcyan
11 - cyan
12 - blue
13 - pink
14 - gray
15 - lightgray
As you can see, HydraIRC is great when it comes to having a well-defined output.
These are just some basic notes cut and pasted from various conversations with people, etc. The should prove useful to anyone who wants to make their own theme though.
Themes are stored in Theme Collection files and you can store more than one theme per file (XML is great!)
See the included themes\default.xml for an example file.
You can change themes for EACH AND ANY WINDOW whenever you like by using the /set command in the window like this:
/set theme=<nameoftheme>
where <nameoftheme> is the same as the name property of a theme node in any theme file in the themes directory.
The themes\default.xml file currently contains two themes, these are called "Basic" and "Alternate".
So, if you used the command:
/set theme=alternate
HydraIRC would scan all *.xml files in Themes\ and will load the theme if it finds it.
HydraIRC has a built-in theme called "Default", HydraIRC will use the build-in theme if for any reason it cannot load the theme that was specified.
HydraIRC 0.336 and before used the "Basic" theme, HydraIRC 0.337 used the "Alternate" theme by default.
HydraIRC 0.338 now has a new preference that allow you to select the default theme for new windows. See "Misc/Default Theme". in prefs.
This can also be set with the command:
/set misc/default theme=<nameoftheme>
Note that XML requires that <'s >'s and &'s are escaped along with the color/reverse/bold/normal/italic change codes, otherwise the XML file cannot be parsed correctly - This is why you can see lots of \003's, \074's and \076's in the themes which are the escaped octal representations of the ASCII values.
To get a '\' character you have to use '\\' or '\134'.
For a list of ASCII characters and their octal values see here
The supported style/codes are:
'\002' bold
'\003' color change '\003<2 digit decimal foreground>[,<2 digit
decimal background>]'
'\004' hi-color change '\004<6 digit hex foreground>[,<6 digit hex
background>]'
'\037' underline
'\035' italics
'\026' reverse foreground and background colors.
'\017' set normal forground and background colors. (per line basis in HydraIRC)
'\006', '\022' and '\023' are stripped from the output
it's probably not a good idea to use linefeeds and carriage returns (these will probably be stripped at a later date)
Important Notes for theme designers:
When a theme is loaded it is kept in memory and reused by all other windows that use the same theme.
When HydraIRC is told to use a particular theme it first looks to see if it is loaded and if it is then HydraIRC does NOT reload it from disk. So if you want to see changes to a theme you must first make sure no windows are using the theme you're trying to load. This can be done by issuing a "/set theme=default" in each open window.
An example theme line looks like this:
<item appliesto="SCQD" itemid="10002" formatstring="-\074NICK\076- \074ALL\076"/>
The unescaped string looks like this:
-<NICK>- <ALL>
The output might look like this:
-echbot- Game ready to start in #ctfpickup.euro
Search HydraIRCTypes.h for #define RPLS_NOTICE_CONNECT and look at irc.h for
the itemid's
applied to can be a combination of any of the following characters: SCQD which
mean
Server, Channel, Query and DCC Chat respectively.
In the example above, 10002 relates to RPLS_NOTICE, and "SCQD" means this if for ALL windows, <NICK> is replaced with the nick of the person sending the message, <ALL> is replaced with the notice message that was sent.
Hydra_; if you want to see which variables you can use for each itemid
Hydra_; you can search server.cpp for the itemid
`-Anders; allright
Hydra_; and then look at the code just before OutputFormatterLines()
Hydra_; OutputFormatter() lines..
Hydra_; 1 sec, i'll give you an example
`-Anders; mkay
Hydra_; m_Variables[VID_NICK] = a;
Hydra_; m_Variables[VID_USERNAME] = b;
Hydra_; m_Variables[VID_HOST] = c;
Hydra_; m_Variables[VID_NAME] = d;
Hydra_; OutputFormatter(BIC_NOTICE,RPL_WHOISUSER);
Hydra_; so you can see for the SERVER -> RPL_WHOISUSER you can use NICK,
USERNAME, HOST and NAME
`-Anders; pretty straight forward
Hydra_; also....
Hydra_; if you look at this:
Hydra_; void IRCServer::InitVariables( void )
Hydra_; you'll see this:
Hydra_; m_Variables[VID_MYNICK] = m_Nick;
Hydra_; m_Variables[VID_MYHOST] = "localhost"; // TODO: change
Hydra_; m_Variables[VID_SERVER] = m_pDetails->m_Name;
Hydra_; m_Variables[VID_SERVERDESCRIPTION] = m_pDetails->m_Description;
Hydra_; m_Variables[VID_RESPONSE] = m_CurrentResponse;
Hydra_; which can be used in all strings
Hydra_; but RESPONSE is a weird one
Hydra_; as you can't ALWAYS use it...
Hydra_; e.g. you channel text that YOU type in..
Hydra_; e.g. for channel text that YOU type in..
Hydra_; as HydraIRC sends it to the server and displays it itself
Hydra_; and the IRC server doesn't send a response
Hydra_; also, <ALL> doesn't actually mean <ALL> it just means, the
rest of the text that wasn't already put into variables
you can embed timestamps into themes using <TIMESTAMP=timestamp format>, but turning off timestamps will not remove them from the theme (maybe later..)
Here's a useful link:
http://www.opengroup.org/onlinepubs/7908799/xsh/strftime.html
An example timestamp usage might be "<TIMESTAMP=[%Hh%Mm]>" which would result in the following output string "[6h30m]" if it was 6:30pm. If you wanted different parts to be in different colors, then do it like this:
"Ctrl+B[Ctrl+BCtrl+k5<TIMESTAMP=%H>Ctrl+k4hCtrl+k5<TIMESTAMP=%M>Ctrl+K4mCtrl+OCtrl+B]Ctrl+B"
which would look like this:
"[6h30m]"
Notes:
* Clean out your plugins/folder before running new versions.
* If HydraIRC crashes on startup then either log off and back on again, or restart your computer.
* Delete "HKEY_CURRENT_USER\Software\HydraProductions\HydraIRC\WindowStates" from the registry if HydraIRC crashes at startup.
Sergey Klimov for his WTL Docking Windows
Used for the awesome docking windows.
Peter Krnjevic for his patches to Sergey's Docking windows code
Daniel Bowen for his nice .net style tab controls
Used for the TabbedMDI and the tabbed docking windows.
Bjarke Viksoe for his Dialog Container Control and Property View
controls
Used in the Tools/Options dialog
ClipCode.com for their great WTL Developers guide
(Even if it is a bit out of date since VS.NET and WTL 7.0
came out)
CodeProject.com and their contributors and readers
I'd probably be stuck without some good example WTL source
code, thanks!
Anders Hovmöller author of BoxedIRC (GPL)
Without BoxedIRC HydraIRC probably wouldn't exist, it gave
me an incentive to write HydraIRC
The output from early versions of HydraIRC was based on BoxedIRC's output.
Damian Hodgkiss author of OpenIRC (GPL)
The author of BoxedIRC used some source from OpenIRC, so I
guess Damian deserves a mention here too.
Jacek Sieka author of DirectConnect++ (DC++, GPL)
Having the source to DC++ has helped at little when it came
to doing some WTL windowing code in HydraIRC
Jason Whittington for his ASyncMessageMap class.
Used by some multithreading objects.
Rovastar for creating the NSIS installer
All the other IRC clients out there for sucking so much!
They know who they are... ;)
No licensed source code has been used in the creation of HydraIRC. The above mentioned GPL apps were only used as a reference. "e.g. Oh, that's how you do it..."
Zann
Oh Zanny zann zann! :) Your beta testing,
comments suggestions and just general chat have been very helpful. a big
thanks to you!
srobot
Special thanks for creating the amazing icons that are used in HydraIRC
Imajes
Great beta testing, and thanks for the #HydraIRC bot and the
webspace!
YoD, `-Anders, Kez, Frogworm, Indigo2, Rovastar and all the other beta testers
Thanks, thanks and thanks! All your comments, bug
reports and suggestions are a great inspiration to me and they makes me work
harder the more I get! Keep 'em coming
ButtM0nkey
For a couple of minor patches, keep em coming.
(p.s. Shout if your name's not here and you think it should be)
EOF