refreshIfExpired("lasticonsync", function () { // Do not sync icons if we cannot connect the the TS server if (!TeamSpeakUtils::i()->checkTSConnection()) { return null; } ServerIconCache::syncIcons(); return true; }, Config::get("cache_servericons", 300)); } public static function isLocal($iconId) { return $iconId > 0 && $iconId < 1000; } public static function iconIdFromName($iconName) { return substr($iconName, 5); } /** * Converts a 32-bit int to a unsigned int * 32-bit int is obtained for example from the servergroup details (iconid) * Returned value can be used with ServerIconCache's methods like getIconBytes * @see http://yat.qa/resources/tools/ (Icon Filename Tool) * @param $iconId int * @return int */ public static function unsignIcon($iconId) { if (!is_int($iconId)) { throw new \InvalidArgumentException("iconId must be an integer"); } return ($iconId < 0) ? (2 ** 32) - ($iconId * -1) : $iconId; } public static function downloadIcon($iconId) { return TeamSpeakUtils::i()->ftDownloadFile("/icon_$iconId"); } public static function ftDownloadIconList() { try { return TeamSpeakUtils::i()->getTSNodeServer()->channelFileList(0, "", "/icons/"); } catch (\TeamSpeak3_Adapter_ServerQuery_Exception $e) { if ($e->getCode() === 1281) { // database empty result set return []; } throw $e; } } }