courgette/b3-plugin-teamspeak — Issue #1: find client by IP
Author: courgette
Created: 2011-11-06 08:54:51+00:00
State: open

[Mikobiko](http://forum.bigbrotherbot.net/profile/?u=620) [reported](http://forum.bigbrotherbot.net/plugins-by-courgette/teamspeak-plugin-(all-games\)/msg30077/#msg30077) that it can be done.

see `CONNECTION_CLIENT_IP`

See http://pastebin.com/ZPEiFhNu
```C#
///
Sets all the advanced data for a Teamspeak client.

/// The client's information to set from.
public void setAdvancedData(TeamspeakResponseGroup clientInfo)
{
String value;
Int32 iValue;
Boolean bValue;

advLoginName = clientInfo["client_login_name"];
advUniqueId = clientInfo["client_unique_identifier"];
advIpAddress = clientInfo["connection_client_ip"];

advVersion = clientInfo["client_version"];
advPlatform = clientInfo["client_platform"];
advDescription = clientInfo["client_description"];
advCountry = clientInfo["client_country"];
advMetaData = clientInfo["client_meta_data"];

if ((value = clientInfo["client_channel_group_id"]) != null) if (Int32.TryParse(value, out iValue)) advChannelGroupId = iValue; else advChannelGroupId = null; else advChannelGroupId = null;
if ((value = clientInfo["client_servergroups"]) != null) if (Int32.TryParse(value, out iValue)) advServerGroupId = iValue; else advServerGroupId = null; else advServerGroupId = null;
if ((value = clientInfo["client_is_channel_commander"]) != null) if (Boolean.TryParse(value, out bValue)) advIsChannelCommander = bValue; else advIsChannelCommander = null; else advIsChannelCommander = null;

advDefaultChannel = clientInfo["client_default_channel"];
if ((value = clientInfo["connection_connected_time"]) != null) if (Int32.TryParse(value, out iValue)) advConnectionTime = iValue; else advConnectionTime = null; else advConnectionTime = null;
if ((value = clientInfo["client_idle_time"]) != null) if (Int32.TryParse(value, out iValue)) advIdleTime = iValue; else advIdleTime = null; else advIdleTime = null;
if ((value = clientInfo["client_created"]) != null) if (Int32.TryParse(value, out iValue)) advCreationTime = iValue; else advCreationTime = null; else advCreationTime = null;
if ((value = clientInfo["client_lastconnected"]) != null) if (Int32.TryParse(value, out iValue)) advLastConnected = iValue; else advLastConnected = null; else advLastConnected = null;
if ((value = clientInfo["client_totalconnections"]) != null) if (Int32.TryParse(value, out iValue)) advTotalConnections = iValue; else advTotalConnections = null; else advTotalConnections = null;

if ((value = clientInfo["client_input_muted"]) != null) if (Boolean.TryParse(value, out bValue)) advInputMuted = bValue; else advInputMuted = null; else advInputMuted = null;
if ((value = clientInfo["client_output_muted"]) != null) if (Boolean.TryParse(value, out bValue)) advOutputMuted = bValue; else advOutputMuted = null; else advOutputMuted = null;
if ((value = clientInfo["client_outputonly_muted"]) != null) if (Boolean.TryParse(value, out bValue)) advOutputMutedOnly = bValue; else advOutputMutedOnly = null; else advOutputMutedOnly = null;
if ((value = clientInfo["client_input_hardware"]) != null) if (Boolean.TryParse(value, out bValue)) advInputHardware = bValue; else advInputHardware = null; else advInputHardware = null;
if ((value = clientInfo["client_output_hardware"]) != null) if (Boolean.TryParse(value, out bValue)) advOutputHardware = bValue; else advOutputHardware = null; else advOutputHardware = null;
if ((value = clientInfo["client_is_recording"]) != null) if (Boolean.TryParse(value, out bValue)) advIsRecording = bValue; else advIsRecording = null; else advIsRecording = null;

advFlagAvatar = clientInfo["client_flag_avatar"];
advAwayMessage = clientInfo["client_away_message"];
advTalkMessage = clientInfo["client_talke_request_msg"];
advPhoneticNick = clientInfo["client_nickname_phonetic"];
advDefaultToken = clientInfo["client_default_token"];
advBase64Hash = clientInfo["client_base64HashClientUID"];
if ((value = clientInfo["client_talk_power"]) != null) if (Int32.TryParse(value, out iValue)) advTalkPower = iValue; else advTalkPower = null; else advTalkPower = null;
if ((value = clientInfo["client_needed_serverquery_view_power"]) != null) if (Int32.TryParse(value, out iValue)) advQueryViewPower = iValue; else advQueryViewPower = null; else advQueryViewPower = null;
if ((value = clientInfo["client_unread_messages"]) != null) if (Int32.TryParse(value, out iValue)) advUnreadMessages = iValue; else advUnreadMessages = null; else advUnreadMessages = null;
if ((value = clientInfo["client_icon_id"]) != null) if (Int32.TryParse(value, out iValue)) advIconId = iValue; else advIconId = null; else advIconId = null;
if ((value = clientInfo["client_away"]) != null) if (Boolean.TryParse(value, out bValue)) advIsAway = bValue; else advIsAway = null; else advIsAway = null;
if ((value = clientInfo["client_talk_request"]) != null) if (Boolean.TryParse(value, out bValue)) advTalkRequest = bValue; else advTalkRequest = null; else advTalkRequest = null;
if ((value = clientInfo["client_is_talker"]) != null) if (Boolean.TryParse(value, out bValue)) advIsTalker = bValue; else advIsTalker = null; else advIsTalker = null;
if ((value = clientInfo["client_is_priority_speaker"]) != null) if (Boolean.TryParse(value, out bValue)) advIsPriority = bValue; else advIsPriority = null; else advIsPriority = null;

if ((value = clientInfo["client_month_bytes_uploaded"]) != null) if (Int32.TryParse(value, out iValue)) advBytesUpMonth = iValue; else advBytesUpMonth = null; else advBytesUpMonth = null;
if ((value = clientInfo["client_month_bytes_downloaded"]) != null) if (Int32.TryParse(value, out iValue)) advBytesDownMonth = iValue; else advBytesDownMonth = null; else advBytesDownMonth = null;
if ((value = clientInfo["client_total_bytes_uploaded"]) != null) if (Int32.TryParse(value, out iValue)) advBytesUpTotal = iValue; else advBytesUpTotal = null; else advBytesUpTotal = null;
if ((value = clientInfo["client_total_bytes_downloaded"]) != null) if (Int32.TryParse(value, out iValue)) advBytesDownTotal = iValue; else advBytesDownTotal = null; else advBytesDownTotal = null;
if ((value = clientInfo["connection_filetransfer_bandwidth_sent"]) != null) if (Int32.TryParse(value, out iValue)) advFileBandwidthSent = iValue; else advFileBandwidthSent = null; else advFileBandwidthSent = null;
if ((value = clientInfo["connection_filetransfer_bandwidth_received"]) != null) if (Int32.TryParse(value, out iValue)) advFileBandwidthRec = iValue; else advFileBandwidthRec = null; else advFileBandwidthRec = null;
if ((value = clientInfo["connection_packets_sent_total"]) != null) if (Int32.TryParse(value, out iValue)) advPacketsTotalSent = iValue; else advUnreadMessages = null; else advUnreadMessages = null;
if ((value = clientInfo["connection_packets_received_total"]) != null) if (Int32.TryParse(value, out iValue)) advPacketsTotalSent = iValue; else advPacketsTotalSent = null; else advPacketsTotalSent = null;
if ((value = clientInfo["connection_bytes_sent_total"]) != null) if (Int32.TryParse(value, out iValue)) advBytesTotalSent = iValue; else advBytesTotalSent = null; else advBytesTotalSent = null;
if ((value = clientInfo["connection_bytes_received_total"]) != null) if (Int32.TryParse(value, out iValue)) advBytesTotalRec = iValue; else advBytesTotalRec = null; else advBytesTotalRec = null;
if ((value = clientInfo["connection_bandwidth_sent_last_second_total"]) != null) if (Int32.TryParse(value, out iValue)) advBndwdthSecondSent = iValue; else advBndwdthSecondSent = null; else advBndwdthSecondSent = null;
if ((value = clientInfo["connection_bandwidth_received_last_second_total"]) != null) if (Int32.TryParse(value, out iValue)) advBndwdthSecondRec = iValue; else advBndwdthSecondRec = null; else advBndwdthSecondRec = null;
if ((value = clientInfo["connection_bandwidth_sent_last_minute_total"]) != null) if (Int32.TryParse(value, out iValue)) advBndwdthMinuteSent = iValue; else advBndwdthMinuteSent = null; else advBndwdthMinuteSent = null;
if ((value = clientInfo["connection_bandwidth_received_last_minute_total"]) != null) if (Int32.TryParse(value, out iValue)) advBndwdthMinuteRec = iValue; else advBndwdthMinuteRec = null; else advBndwdthMinuteRec = null;
}
}
```