Forum

Results 1 to 5 of 5
  1. #1
    Join Date
    November 2016
    Posts
    2

    setChannelVariable CHANNEL_ICON_ID impossible to change ID

    Hi, I'm going crazy trying to change the icons of my channels with C, I am an admin server, so permissions shouldn't be a problem.
    I can change the names, move channels, and everything using setChannelVariableAsUInt64 or setChannelVariableAsString, but i don't know what to do with icons, i have tried everything.
    I always receive the same error: ERROR_parameter_invalid = 0x0602; so the variables i give to the server are no the right ones it seems.

    I have read that the stored ID is a CRC32 checksum, but not sure if that have something to do with the variable.

    This is one of my tries:

    uint64 p;
    int error = ts3Functions.getChannelVariableAsUInt64(serverConn ectionHandlerID, (uint64)304, CHANNEL_ICON_ID, &p);
    if (error != ERROR_ok) {
    printf("Error taking string, error: %04x\n", error);
    return FALSE;
    }

    int error2 = ts3Functions.setChannelVariableAsUInt64(serverConn ectionHandlerID, (uint64)304, CHANNEL_ICON_ID, p);
    if ( error2 != ERROR_ok) {
    printf("Pongo %lld\n", p);
    printf("Error poniendo el icono como string, error: %04x\n", error2);
    return FALSE;
    }
    ..........
    and the flushChannelUpdates goes next, but error2 is always 602.

    I have tried using uint64*, char*, the value itself with as char with"", number withou"", but no luck so far.
    The IDs have some weird ui64 shape, being like: 2651044484

    I can change the icon from the graphic panel of the TS3, and the id's seems the same than the ones received by code.
    I tried to change other channels icons but no one goes well, i cannot even assign id=0, what i thought was "no icon".

    I would really appreciate some help, because i don't know how to continue.

    Thanks!!

  2. #2
    Join Date
    September 2012
    Posts
    6,078
    The icon is a permission and you'll thus have to set it like that.

    Code:
    			unsigned int perms[] = {142 /* i_icon_id */};
    			int permValues[sizeof(perms)/sizeof(unsigned int)];
    			permValues[0] = 200; // The ID of the icon you want to set
    			unsigned int err = 0xFFFF;
    			if ((err = ts3.requestChannelAddPerm(serverConnectionHandlerID, chanId, perms, permValues, (sizeof(perms)/sizeof(unsigned int)), nullptr)) != ERROR_ok) {
    				// This is an error
    				return;
    			}
    Note that you will most likely only ever receive an error other than ERROR_ok if you're not connected. Most other errors will be sent through the error events since this function needs to request things from the server and the server may deny the change. So even if the requestChannelAddPerm call returns ERROR_ok, that doesn't mean that the icon was actually changed on the server.
    Last edited by Chris; November 29th, 2016 at 12:22 PM. Reason: whoops
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  3. #3
    Join Date
    November 2016
    Posts
    2
    Thank you so much!!!!!! That worked almost perfectly, you really helped me here.
    I succeed at changing the icon, but I keep receiving an error message of insufficient permission modify power, the icon is properly changed on my client, and in others, so i assume that in fact the server changed it. Why do i receive the insufficient permissions if the change is made?

    By the way, is there any documentation about the permissions ID of the array? I can see their ids and values requesting the permissions list, and guess which one is each one by the value, but just to have a look, since the SDK documentation doesn't say anything about permissions.

    Thank you again!!

  4. #4
    Join Date
    May 2016
    Location
    Idar-Oberstein
    Posts
    163
    Shot from the hip, iirc sizeof will return the size of the array in bytes, hence the two sizeof(perms) would be 4 - resulting in the client expecting 4 permissions to be read where only the first is properly set.
    auto number_of_elements = sizeof(perms) / sizeof(unsigned int);

  5. #5
    Join Date
    September 2012
    Posts
    6,078
    Quote Originally Posted by MiguelSnake View Post
    Thank you so much!!!!!! That worked almost perfectly, you really helped me here.
    I succeed at changing the icon, but I keep receiving an error message of insufficient permission modify power, the icon is properly changed on my client, and in others, so i assume that in fact the server changed it. Why do i receive the insufficient permissions if the change is made?

    By the way, is there any documentation about the permissions ID of the array? I can see their ids and values requesting the permissions list, and guess which one is each one by the value, but just to have a look, since the SDK documentation doesn't say anything about permissions.

    Thank you again!!
    That's because I was trying to make it more versatile for you when I was copying the code over to the forum after testing and forgot to divide the sizeof output. Fixed above.

    As for the permission Ids, there are (or at least used to be) some lists around the internet, other than that you can just request the permission list from the server, which will call the permissionListEvent (in a plugin anyway) giving you the ID and the permission name (among other info).
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Resolved] channeledit channel_icon_id=x not saved
    By numma_cway in forum Bug Reports [EN/DE]
    Replies: 37
    Last Post: June 17th, 2019, 06:04 PM
  2. channel_icon_id problem (out of range)
    By filimonic in forum Linux / FreeBSD
    Replies: 1
    Last Post: June 19th, 2012, 11:07 AM
  3. [Resolved] ServerQuery channel_icon_id problem
    By devour in forum Linux / FreeBSD
    Replies: 1
    Last Post: January 26th, 2012, 09:02 AM
  4. Permanent Ban impossible !
    By yepos in forum Permission System
    Replies: 3
    Last Post: June 17th, 2011, 10:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •