Page 1 of 1

help with custom service

Posted: Sun Jun 16, 2013 6:19 am
by SoulReaper
Okay I know a fair share of programming, not enough to make me a pro (otherwise I would not be making this post lol )

Anyways, and old IRC community I belonged to had a custom made IRC service, but the problem was the service was so outdated, and its combined between C and MySQL it's real hard to "fix" especially when I do not know MySQL. I Plan to recode the service, to get it operational once more. I have read up on IRC Protocol and know that a "service" needs to memorize channelmodes/usermodes etc. (can I get a full list of what needs to be memorized please?)

One main issue is I cant really "scavenge" what I need for the rework because of the MySQL integration - this is why i decided to recode it.

But as it stands right now, I cannot get the "core" to connect as a Server to IRC (sadly if anything it connects as a client) I have read the connection registration (Pass/Nick/User) and giving all of them but still no connection as a server.

Another issue is, I dont even understand how a "connection" is considered a server by the IRC server

Re: help with custom service

Posted: Sun Jun 16, 2013 9:52 am
by SoulReaper
Update:
I figured it out, there was one more command I was forgetting. the SERVER one

Re: help with custom service

Posted: Sun Jun 16, 2013 7:06 pm
by Stealth
When it comes to services tracking and remembering things, it's up to you to determine that. Different services packages remember different things based on the need to provide the desired service to the clients on the network.

As for starters, here's what a services server needs to track as part of normal and successful operation:
  • The users currently connected to the network, which includes:
    • Their current nickname.
    • Their username (before the @).
    • Their real hostname.
    • Their cloaked hostname.
    • The modes they have.
    • The channels they are a member of.
  • The channels on the server, including:
    • Names of each channel.
    • Who is in these channels.
    • The channel modes of each channel.
    • What rank each user has in the channel.
Remember that when something is connected to your network as a server, it will receive all the user information upon linking and as information changes. There will be no way for it to look up information once it is connected.

Re: help with custom service

Posted: Wed Jun 19, 2013 6:43 pm
by SoulReaper
I was just wondering, what would happen if, its not remembered?

Re: help with custom service

Posted: Thu Jul 04, 2013 3:54 pm
by Stealth
If your services package doesn't "remember" something, there is no way to retrieve it. If it's something that's important to operation (such as channel rank) you could end up causing desyncs or annoyances to users.

Re: help with custom service

Posted: Sun Jul 07, 2013 9:15 am
by SoulReaper
I'm doing this in c++, and basically I am using:

vector<string> usernames - probably not the best thing to use, but this is for test, however this is not even the error.

anyways, I also have the buffer split into tokens via the vector <string>, anyways I have some checks - they log fine but it seems the irc server the server is connecting to is only reporting 4 NICK commands, and there is over 40 users on the actual network, so something is wrong.

the server is linked between 3 others, and I was wondering to get a "full" list does it need to be connected to the "hub" server instead? because the one the server is connecting to is a leaf

the server is still reporting things like modes, etc... from other servers. but it is only reporting like 2 NICKS, (it works fine with they actually connect, just not for ones already connected)

Re: help with custom service

Posted: Sun Jul 07, 2013 1:59 pm
by katsklaw
Leafs are not allowed to introduce servers so no other server except its uplink(s) are allowed to connect. That means that your services cannot be connected to a leaf. As soon as you try, the hub your leaf is connected to will break the connection.

Leaf = cannot connect other servers aside from it's uplink.
Hub = can connected any other server, leaf or hub as well as an uplink.

Services should be connected as a hub as well or you can't jupe servers. All the other servers should have a uline block for your services server before services connects so they are introduced as a ulined server.

By saying you connected services to a leaf says that either the leaf is not really a leaf, but a hub, or services is the only other server your "leaf" is connected to. The *only* way you have services connected to a leaf and not have catastrophic failure someplace is if you have services it's self connected as a client and not a server.

Re: help with custom service

Posted: Sun Jul 07, 2013 7:17 pm
by SoulReaper
sorry, but I'm pretty sure this one server (my server) my Services is connecting to is a leaf, even the hub has it set as a leaf and my server is set as a leaf as well.
the service is ulined in all 3 servers.

The service connects,responds to pings.

it reports MODES/JOINS/PARTS/KICKS/QUITS/NICKS across all servers just fine (at this point its easy to do what I need)
the problem is as soon as it connects, it seems like its not given all the "networks data" and as mentioned before with a few if checks (that work) its only reporting like four NICK commands at startup.

the reason i'm not testing this on the hub is because a, i do not want to crash the hub server. I've done flooded out my server a few times to the point were I had to go into the box and restart the ircd

so, if this needs to be conncted to a hub, ill just launch another ircd as a hub, and test on that.

Re: help with custom service

Posted: Sat Jul 13, 2013 6:55 pm
by Syzop
UnrealIRCd will synchronize all users and channels to a new server, doesn't matter if it's a leaf or hub or connected to a leaf or hub.

So most likely you have a programming error, possibly in the buffer code.

You can use a network sniffer to see what UnrealIRCd is really sending.
On Windows you can use Wireshark, and on Linux you can use ngrep (eg: ngrep -d eth0 -W byline '' 'host 1.2.3.4 and port 6667').
Naturally this doesn't work if you're using SSL/TLS, and it requires root / admin access.

Re: help with custom service

Posted: Sat Jul 13, 2013 10:34 pm
by Jobe
SoulReaper, is it at all possible that in a whole packet read, you're only parsing the FIRST IRC message in the packet?

Note: Sometimes (especially during burst) a single packet received will contain more then one message.

This is why it is important to instead of just parsing up until the first \r\n, but continuing past it for extra messages.

Re: help with custom service

Posted: Sat Jul 20, 2013 11:24 pm
by SoulReaper
Now that you mention that, it is very possible. All I did was include a if check really, nothing is being processed at all.
I did not even consider that possibility.