Scordo / TS3QueryLib.Net

This library allows you to query team speak 3 servers using the query port. All queries are implemented type safe and the library is written to work with .Net 3.5 SP1 or higher inluding support for silverlight 3.0 or higher and windows phone 7.1.
BSD 3-Clause "New" or "Revised" License
51 stars 14 forks source link

Update ExtensionMethods.cs #10

Closed XoMEX closed 8 years ago

XoMEX commented 9 years ago

A quick hotfix for #5

FireEmerald commented 9 years ago

Can't confirm that error, please provide a way to reproduce the issue you want to fix.

Dim _rChannelCreate As Responses.SingleValueResponse(Of UInteger?)
Dim _ChannelModification As New Server.Entities.ChannelModification With {.Name = "QueryChannelName", _
                                                                          .IsPermanent = True}
_rChannelCreate = _qRunner.CreateChannel(_ChannelModification)

PrintDebugLine(_rChannelCreate.StatusText)

-> error id=0 msg=ok / Channel created with no exception. Server Version: 3.0.10.3 (01.01.2014 17:28:39) on Linux

XoMEX commented 9 years ago
       if (QueryRunner.Login("serveradmin", "<pwd>").IsErroneous)
        {
            MessageBox.Show("login error");
            return;
        }
        QueryRunner.SelectVirtualServerById(1);

        QueryRunner.RegisterForNotifications(ServerNotifyRegisterEvent.Channel,0);

        ChannelModification c = new ChannelModification();
        c.IsPermanent = false;
        c.IsSemiPermanent = false;
        c.IsTemporary = true;
        c.ParentChannelId = 6;
        c.ChannelOrder= null;
        c.Name = "abc";

        SingleValueResponse<uint?> res = QueryRunner.CreateChannel(c);

the problem is, it tries to convert "289\n\rnotifychannelcreated" to an uint.

When thinking about my solution right now (i've made it a while back) I see the problem, but don't know how to fix that in a good way...

FireEmerald commented 9 years ago

For what do you need this line?

QueryRunner.RegisterForNotifications(ServerNotifyRegisterEvent.Channel,0);
XoMEX commented 9 years ago

In this example, for reproducing the bug. But I use this API in a bot which needs to listen to client moves, and those are a channelevent.

FireEmerald commented 9 years ago

Year, but where do you handle the ServerNotifyRegisterEvent - didn't found a way to handle the event. There's only a UnknownNotificationReceived Event which won't be triggered.

XoMEX commented 9 years ago

In my Bot I use

            QueryRunner.Notifications.ClientMoved += Notifications_ClientMoved;
            QueryRunner.Notifications.ClientMoveForced += Notifications_ClientMoveForced;
FireEmerald commented 9 years ago

For me it seems like the QueryRunner waits for a Responses.SingleValueResponse(Of UInteger?) but receives a ServerNotifyRegisterEvent which has an other structure.

XoMEX commented 9 years ago

It mixes two things up, cause those lines come more or less at the same time: the channel creation, and the event the channelcration triggers (and maybe the move, because its a temporary channel).

Here's the Traffic caused in the example

< TS3
Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and "help <command>" for information on a specific command.

> login client_login_name=serveradmin client_login_password=<pwd>
< error id=0 msg=ok

> use sid=1
< error id=0 msg=ok

> servernotifyregister event=channel id=0
< error id=0 msg=ok

> channelcreate channel_name=abc channel_flag_permanent=0 channel_flag_semi_permanent=0 channel_flag_temporary=1 cpid=6
< cid=300

< notifychannelcreated cid=300 cpid=6 channel_name=abc channel_order=0 channel_flag_permanent=0 channel_flag_semi_permanent=0 invokerid=3 invokername=serveradmin\sfrom\s127.0.0.1:20843 invokeruid=serveradmin

< notifyclientmoved ctid=300 reasonid=1 invokerid=0 invokername=Server clid=3

notifyclientmoved ctid=300 reasonid=1 invokerid=0 invokername=Server clid=3

error id=0 msg=ok