Closed realKitsune closed 6 years ago
Interesting, I'll have to test this locally.
I know there's some specific handling regarding the icon_id, something about max int, signed, etc and some special handling (i.e. this is why there is a negative sign).
I'm not sure if this is the issue you're running into (you could search the forums for related issue with icon_id), but it may also be there is a problem with the channelCreate()
logic.
In the meantime, as a testing step, you might also try:
icon_id
, i.e. something less than 2^31 or has less than 10 significant digits.I was testing this in the morning using directly the ServerQuery (via SSH) and a "convert error" was returned (using both positive and negative iconid). The problem seems to be related to the ServerQuery directly, not this framework. Though, my test finishes here, I had no more time to investigate better.
Awesome, thanks for the insight @snegrini.
I remember correctly, there's specifically some conversion logic when mapping icon_id
s between server
<--> client
.
I believe Janni goes into this a bit on his Redeemer / YaTQA site somewhere... Here is a post discussing it (unsure if this is still an issue in the framework): https://forum.teamspeak.com/threads/54132-API-TS3-PHP-Framework?p=416546#post416546
In any case, I'll still try to reproduce via framework, would be a great opportunity to add unit tests for icon management.
Also of possible relevance: https://forum.teamspeak.com/threads/54132-API-TS3-PHP-Framework?p=453588#post453588
I'm also finding lots of examples where setting channel_icon_id
on channel creation is not working:
$ts3->message("Přidávám dodatečné místnosti...");
global $chann1, $chann2, $chann3;
try {
$chann1 = $ts3->channelCreate(array (
"channel_name" => "Additional public room #1",
"channel_topic" => "",
"channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
"channel_codec_quality" => 6,
"channel_flag_permanent" => TRUE,
"channel_order" => 370,
//"channel_icon_id" => 1513344601,
));
$chann2 = $ts3->channelCreate(array (
"channel_name" => "Additional public room #2",
"channel_topic" => "",
"channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
"channel_codec_quality" => 6,
"channel_flag_permanent" => TRUE,
//"channel_icon_id" => 1031730392, //NOT working ATM, need to fix
"channel_order" => $chann1,
));}
At this point, it's seems a lot like, while channel_icon_id
is a valid server property
, it may be that server query does not accept it via channelcreate
command. [ref]
I would recommend trying to set icon_id manually after creating channel and see if this works.
Doesn't work also with
$ts3_VirtualServer->execute("channeledit", array("cid" => $ownChannel_cid, "channel_icon_id" => -1452005422));
So this value can be grabbed with query but not modified?
Setting it manually works fine but that would not help. Is there a way then like uploading an icon and setting it directly to the channel with the API? Has someone did it before?
$ts3_VirtualServer->execute("channeledit", array("cid" => $ownChannel_cid, "channel_icon_id" => 1646637303));
Seems to work fine, I think that might be related to negative value of icon_id.
EDIT:
After some tests, it works with positive values of icon_id when using channelEdit
Does channelCreate()
work using those same positive values?
If so, this would clearly indicate that there is an issue with the negative numbers.
I'm almost positive this is a classic issue, as I've ran into it a couple times myself, but I thought it was resolved.
This link could help: https://yat.qa/ressourcen/definitionen-und-algorithmen/#icons
It seems that channeledit
wants a unsigned value.
Does
channelCreate()
work using those same positive values?If so, this would clearly indicate that there is an issue with the negative numbers.
I'm almost positive this is a classic issue, as I've ran into it a couple times myself, but I thought it was resolved.
No it doesn't seems to work, only when using channeledit
and negative numbers.
That's the reason I added TeamSpeak3_Helper_Convert::iconId()
a while ago... Also, please note that the icon ID is actually a channel permission. There are a few commands where setting the icon ID will work for convenience (if it has been implemented in the TeamSpeak Server)... but I'm not sure if channelcreate
is one of those.
I'd recommend setting the channel permission after the channel was created. Here's an example:
$channel_id = $server->channelCreate($args);
$icon_id = TeamSpeak3_Helper_Convert::iconId(-123);
$server->channelPermAssign($channel_id, "i_icon_id", $icon_id);
Looks like this solution should work for you. If you're still having issues, please let us know!
EDIT: todo - add example of icon conversion to wiki.
That's the reason I added
TeamSpeak3_Helper_Convert::iconId()
a while ago... Also, please note that the icon ID is actually a channel permission. There are a few commands where setting the icon ID will work for convenience (if it has been implemented in the TeamSpeak Server)... but I'm not sure ifchannelcreate
is one of those.I'd recommend setting the channel permission after the channel was created. Here's an example:
$channel_id = $server->channelCreate($args); $icon_id = TeamSpeak3_Helper_Convert::iconId(-123); $server->channelPermAssign($channel_id, "i_icon_id", $icon_id);
Just to note: this method still gives me a negative number which doesn't work. But now it works for my solution. I edited a pixel of the image to change icon_id and I got a positive id.
Thanks for the report, I'll keep this on the list for testing so we can make sure to iron out how it behaves.
Glad you got it working with a workaround!
Hello.
I'm trying to make a one-click button to create a private channel. Here is my actual code:
'channel_icon_id' => $iconeid is set : $iconeid = -1452005422;
I checked the icon_id by setting it manually on a channel then checked with 'channel_icon_id' and it's -1452005422. The code works if I remove the icon id flag, it doesn't work when I add it.
Need some help here :)