help with custom service

The UnrealIRCd team does not officially provide support for any services packages that you may be using or want to use. This forum is provided so the community can help each other with services issues.

Moderator: Supporters

Post Reply
SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

help with custom service

Post by SoulReaper » Sun Jun 16, 2013 6:19 am

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

SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

Re: help with custom service

Post by SoulReaper » Sun Jun 16, 2013 9:52 am

Update:
I figured it out, there was one more command I was forgetting. the SERVER one

Stealth
Head of Support
Posts: 2086
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Re: help with custom service

Post by Stealth » Sun Jun 16, 2013 7:06 pm

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.

SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

Re: help with custom service

Post by SoulReaper » Wed Jun 19, 2013 6:43 pm

I was just wondering, what would happen if, its not remembered?

Stealth
Head of Support
Posts: 2086
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Re: help with custom service

Post by Stealth » Thu Jul 04, 2013 3:54 pm

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.

SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

Re: help with custom service

Post by SoulReaper » Sun Jul 07, 2013 9:15 am

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)

katsklaw
Official supporter
Posts: 1114
Joined: Sun Apr 18, 2004 5:06 pm

Re: help with custom service

Post by katsklaw » Sun Jul 07, 2013 1:59 pm

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.

SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

Re: help with custom service

Post by SoulReaper » Sun Jul 07, 2013 7:17 pm

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.

Syzop
UnrealIRCd head coder
Posts: 1813
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: help with custom service

Post by Syzop » Sat Jul 13, 2013 6:55 pm

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.

Jobe1986
Official supporter
Posts: 1177
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Re: help with custom service

Post by Jobe1986 » Sat Jul 13, 2013 10:34 pm

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.

SoulReaper
Posts: 10
Joined: Tue Aug 11, 2009 9:43 pm

Re: help with custom service

Post by SoulReaper » Sat Jul 20, 2013 11:24 pm

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.

Post Reply