Forum

Results 1 to 9 of 9
  1. #1
    Join Date
    December 2012
    Posts
    14

    Client window refresh

    My plugin uses the right column of the client window to show some plugin related data. So far it works fine. The data are set by the callback function 'ts3plugin_infoData'. These data may change during the session and the window needs to be refreshed. This can only be done by clicking an item in the left column. Does anybody know how to enforce a client window refresh out of a plugin without user interaction ?

    Regards
    Bosshog

  2. #2
    Join Date
    October 2012
    Location
    Germany
    Posts
    553
    Hm, let me pre-state that I only had once a look at this feature a while back, so take it with a huge grain of salt.
    Iirc the data should be settable dynamically, so the problem would in fact be a missing redraw since there's no trigger - as you stated.

    Shot from the hip I could imagine working around it like that, if you're willing to use Qt. I could, however, also imagine the devs won't like that much or at all (or maybe they do, it's not my place to say, just saying as I would understand that folks hacking around in the main app outside of their API might not be of everyone's taste), so I would very much refrain from calling it recommended practice and first wait out if/what they have to say or can do about that.
    Last edited by Philosound; January 11th, 2013 at 05:23 PM. Reason: removed some mindless babbling

  3. #3
    Join Date
    December 2012
    Posts
    14
    Thanks for the answer. I tried a similar approach with 'FindWindow'. The required window title and class could be found with Spy++. No luck... I assume the developers found a way to reject the access to the application window. But I observed a reaction on an unknown trigger which caused a refresh. When I know the source, I will post it here in.
    Thanks again
    Bosshog

  4. #4
    Join Date
    September 2012
    Posts
    6,076
    Actually you can request to update the info frame by calling requestInfoUpdate

  5. #5
    Join Date
    December 2012
    Posts
    14
    Hi Chris,
    sorry for answering late. I made some experiments with 'requestInfoUpdate'. I didn't get it to work. It does not trigger the required 'ts3plugin_infoData' function. If I look to the third argument of 'requestInfoUpdate', it seems, that the function is used for plugin menus. My client information string is created and shown out of 'ts3plugin_infoData' , case PLUGIN_CLIENT. So I would need a function which initiates a call to 'ts3plugin_infoData' with PLUGIN_CLIENT as PluginItemTyp. The function is triggered if I manually click a different client name in the tree of the left sub window of TS3. Is there any back door to get a refresh of the right sub window out of a plugin?
    Regards
    BOSSHOG
    Attached Images Attached Images  

  6. #6
    Join Date
    September 2012
    Posts
    6,076
    It is working just fine:

    Code:
    static int m_InfoType = 0;
    static int m_InfoId = 0;
    static int m_counter = 0; // Dummy variable to have something that changes, so we can display something
    
    void ts3plugin_infoData(uint64 serverConnectionHandlerID, uint64 id, enum PluginItemType type, char** data) {
    	m_counter++; // Increase dummy counter
    	m_InfoType = type; // Save type when user manually changes the selected Item
    	m_InfoId = id; // Save currently selected Item
    
    	// Your Code that generates and writes the required Info to **data goes here
    
    	// As an example we will just put the counter...
    	*data = (char*)malloc(INFODATA_BUFSIZE * sizeof(char));
    	snprintf(*data, INFODATA_BUFSIZE, "infoData called %d times", m_counter);
    }
    Now the following piece of code goes wherever you need to refresh the info frame...
    Code:
    if (m_InfoType > 0 && m_InfoId > 0) ts3.requestInfoUpdate(serverConnectionHandlerID, m_InfoType, m_InfoId);

  7. #7
    Join Date
    December 2012
    Posts
    14
    Hi Chris,
    works like a charme. The old rule applies: as soon as you do it right, it works by surprise...

    Thank yo so much,
    BOSSHOG

  8. #8
    Join Date
    April 2013
    Posts
    6

    Client Window Refresh #2

    Hi,

    I have a question about the "requestInfoUpdate" function. I have already read this thread which has proved useful.

    The plugin I'm writing interfaces with an external program (OK - it's the FSUIPC interface for various flight simulators) and the monitoring of changes of simulator status is effected by a worker thread created by, but running independently of the TS plugin interface. The effect I'm seeking to achieve is to display changing data in the TS Information area as it changes.

    Invoking the "requestInfoUpdate" function from within the worker thread broke things badly - looking at the stack trace, it falls over somewhere in Qt. Given the workaround I've implemented, I'm pretty sure that it's down to something in Qt not being too happy about being invoked from a different thread.

    The workaround I've come up with is to invoke "requestServerVariables" and then to invoke "requestInfoUpdate" from within the "onServerUpdatedEvent" handler. This works fine - no crashes and the information pane updates as expected - presumably because execution is back in the right thread.

    My question is simple - is there a better, more "approved" way of forcing a safe invocation of "requestInfoUpdate"?
    Last edited by dante696; July 2nd, 2015 at 09:24 AM. Reason: merged / same topic same function does not need a new thread

  9. #9
    Join Date
    March 2016
    Posts
    8
    Oh god I somehow missed your answer, and I was looking for a workaround for a month for the background thread thing! Thank you and +1 internet for you!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how refresh client information
    By 1230456 in forum Client Plugins / Lua Scripts
    Replies: 3
    Last Post: October 6th, 2015, 05:40 PM
  2. [Resolved] Client 3.0.8.1, ban window
    By Screech in forum Bug Reports [EN/DE]
    Replies: 3
    Last Post: August 3rd, 2012, 02:08 PM
  3. Replies: 0
    Last Post: July 16th, 2011, 07:34 PM
  4. Replies: 9
    Last Post: September 17th, 2010, 12:22 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
  •