diff --git a/repository_browser/config/7za.exe b/repository_browser/config/7za.exe new file mode 100644 index 0000000..772e703 Binary files /dev/null and b/repository_browser/config/7za.exe differ diff --git a/repository_browser/config/rep_cfg.kvc b/repository_browser/config/rep_cfg.kvc new file mode 100644 index 0000000..32c11d1 --- /dev/null +++ b/repository_browser/config/rep_cfg.kvc @@ -0,0 +1,10 @@ +# KVIrc configuration file +[Main] +UrlList=http://kvirc.alexzulu.ru,http://kvirc-addons.buriedalive.ru/ +CurrentPeriod=15 +CurrentUrl=http://kvirc.alexzulu.ru +Cache=TYPE YOUR CACHE PATH HERE! +Version=4.0.0 +Groups=All,Tools,Games,Multimedia,Internet,Others,Old%20version +PeriodsList=15,30,60,90,120 +AutoUpdateList=0 diff --git a/repository_browser/config/rep_info.xml b/repository_browser/config/rep_info.xml new file mode 100755 index 0000000..00febc7 --- /dev/null +++ b/repository_browser/config/rep_info.xml @@ -0,0 +1,312 @@ + + + + hellmediaplayer + 0.1.0 + Hell Mediaplayer + A simple script for announcing mp3s that are played by someone + 4.0.2 + 04.11.2016 + HelLViS69 + Multimedia + 0 + + + gen_installer + 2.0.2 + Install.kvs generator + The script to automatically create an installer file install.kvs. + 4.2.0 + 16.10.2016 + alexzulu + Tools + 0 + + + newsticker + 2.0.0 + Newsticker: The RSS News Reader + Displays RSS news feeds from various sources. Updated for KVIrc 4.2.0. + 4.2.0 + 14.10.2016 + Szymon Stefanek(Pragma) + Internet + 0 + + + minesweeper + 1.1.0 + Minesweeper Game + A nice "time eater" + 4.2.0 + 12.10.2016 + Szymon Stefanek + Games + 0 + + + repository_browser_lin + 2.0.4 + Repository browser for Linux + Repository browser for Linux. New repository mirror added + 4.2.0 + 11.10.2016 + alexzulu + Tools + 0 + + + auto_away + 2.0.2 + Auto away + Upgraded auto away. + 4.2.0 + 11.10.2016 + alexzulu + Tools + 0 + + + SysInfo + 1.2.2 + SysInfo + SysInfo alias + 4.4.2 + 29.09.16 + un1versal + Tools + 0 + + + repository_browser_win + 2.1.0 + Repository browser for Windows + The interface is changed. The format of the list of add-ons (now stored in the xml). Changed the mechanism updates to plugins. Изменён интерфейс. Изменён формат списка дополнений(теперь хранится в xml). Переделан механизм обновления дополнений. + 4.2.0 + 07.07.16 + alexzulu + Tools + 0 + + + znctool + 0.1.0 + ZNC tool + Menu for ZNC bouncer + 4.0.0 + 17.02.13 + Prof. BiG BanG + Tools + 0 + + + clearall + 0.0.1 + Clear windows + Clear windows with arguments + 4.0.0 + 11.12.12 + b0nk + Tools + 0 + + + player_control + 1.0.2 + The player control + Скрипт управления проигрывателя с настраиваемой строкой отображения проигрываемой композиции в канал. Добавлена перекодировка тэгов с cp1251 в utf8 на лету. Теперь интерфейс на русском и английском. + 4.0.2 + 22.12.14 + alexzulu + Multimedia + 0 + + + pastebin + 0.0.1 + Pastebin.com Utility + Pastebin.com Utility + 4.0.4 + 08.02.12 + alexzulu + Tools + 0 + + + paste + 2.0.0 + Sticky Notes Pastebin Utility + Sticky Notes Pastebin Utility + 4.0.2 + 25.01.12 + alexzulu + Tools + 1 + + + recent_editor + 0.0.1 + recent_editor-0.0.1.tar.gz + Recent editor + Editor for recent lists + 4.0.4 + alexzulu + Tools + 18.01.12 + 0 + + + hlog + 0.2.0 + Highlight log + Highlight log and viewer + 4.0.2 + 24.12.14 + alexzulu + Tools + 0 + + + deadbeef_control + 1.0.3 + deadbeef player control + deadbeef player control + 4.0.0 + 07.12.12 + Prof. BiG BanG + Multimedia + 0 + + + slaps_l7508 + 0.0.1 + Slaps and greetings + Slaps and greetings(Слапы и приветствия). + 4.0.0 + 13.10.11 + unknown + Others + 0 + + + lag_control + 0.0.6 + Lag control + Automatically reconnect a client to a server with a long delay.(Автоматическое пересоединение клиента с серверами с большим лагом.) + 4.0.2 + 09.09.11 + alexzulu + Tools + 0 + + + favorites + 1.0.2 + Favorites + Создание списка избранных каналов и управление им. + 4.0.2 + 17.03.13 + alexzulu + Tools + 0 + + + chanstats + 2.0.0 + Channel Statistics + Shows Statistics for a joined channel + 4.0.2 + 29.09.16 + g00dsP33D + Tools + 0 + + + chanops + 1.0.0 + Channel Operations + Provides toolbar buttons for several commonly used channel operations + 4.0.2 + 05.10.10 + Szymon Stefanek + Tools + 0 + + + twinsmediaplayer + 1.1.0 + The Twins Mediaplayer + An interface to the Mediaplayer module to play music and advertise it + 4.0.2 + 04.10.10 + Ahinu + Multimedia + 0 + + + twininputcolor + 1.2.0 + The Twins Input Text Coloriser + Colorizes your text in channel, queries and DCC chats. + 4.0.2 + 04.10.10 + Ahinu + Others + 0 + + + reverse2 + 2.6.4 + Reverse2 + Reverse2 - keyboards char-reverse + 4.0.2 + 04.10.10 + runkoff + Tools + 0 + + + diksi_slaps + 1.0.0 + [Diksi] slaps + Менюшка с такими прикольными слапами. Можно издеваться над народом на канале. + 4.0.2 + 04.10.10 + [Diksi] + Others + 0 + + + amaranth + 1.6.1 + Amaranth + An interface to the Mediaplayer module + 4.0.2 + 04.10.10 + Blaze + Multimedia + 0 + + + tools_panel + 0.0.1 + Tools buttons panel + Небольшая панель с кнопками часто выполняемых команд + 4.0.0 + 16.11.10 + alexzulu + Tools + 0 + + + debug_tools + 0.0.1 + Debug tools + Debug tools for KVS + 4.2.0 + 02.03.13 + alexzulu + Tools + 0 + + diff --git a/repository_browser/init.kvs b/repository_browser/init.kvs new file mode 100755 index 0000000..3603f33 --- /dev/null +++ b/repository_browser/init.kvs @@ -0,0 +1,2 @@ +%Set = $new(repository_browser::settings); +repository_browser::updateList diff --git a/repository_browser/install.kvs b/repository_browser/install.kvs new file mode 100644 index 0000000..efcadc4 --- /dev/null +++ b/repository_browser/install.kvs @@ -0,0 +1,58 @@ +#Generate with Installer generator 0.0.1 (19:51:26 10.11.2016) + +# Written by alexzulu(2016) + +# register the script: this must be the first instruction executed +# since it will abort with an error when a greater version is already installed + +addon.register("repository_browser","3.0.8",$tr("Repository browser",repository_browser),$tr("Repository browser",repository_browser),"4.2.0",repository_browser/rp_button.png) +{ + # This is our uninstall callback: it will be called by KVIrc when addon.uninstall is invoked + # This is an automatically generated alias that will erase the installed files + + repository_browser::uninstallfiles +} + +# Ok, addon.register succeeded. We can go on with the installation. + +# Get the path that this script was launched from +%mypath = $file.extractPath($0) + +# get the installer helper class (this is pretty standard and included in the distro) +parse %mypath/utils/installer.kvs + +# The installer will copy our files and generate automatically +# an uninstallation alias for them +%installer = $new(installer,0,myinstaller) + +# Copy files in each subdirectory + +# the configs +if(!$file.exists($file.localdir("config/repository_browser"))) +{ + file.mkdir $file.localdir("config/repository_browser") +} +%installer->$copyFiles("%mypath/config/","*.*","$file.localdir("config/repository_browser")") + +# the locales +%installer->$copyFiles("%mypath/locale/","*.mo","$file.localdir("locale")") + +# the pics +if(!$file.exists($file.localdir("pics/repository_browser"))) +{ + file.mkdir $file.localdir("pics/repository_browser") +} +%installer->$copyFiles("%mypath/pics/","*.png","$file.localdir("pics/repository_browser")") + +# parse source files +%installer->$includeFiles("%mypath/src/","*.kvs") + +# then generate the uninstall alias +%installer->$generateUninstallAlias("repository_browser::uninstallfiles") + +%installer->$includeFiles("%mypath/","init.kvs") + +# finally kill the installer helper +delete %installer + +# Done: the addon is installed and running: enjoy :) diff --git a/repository_browser/locale/repository_browser.pot b/repository_browser/locale/repository_browser.pot new file mode 100755 index 0000000..f70eed0 --- /dev/null +++ b/repository_browser/locale/repository_browser.pot @@ -0,0 +1,158 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-18 17:25+0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: actions.kvs:1 +msgid "Repository browser" +msgstr "" + +#: actions.kvs:1 +msgid "Open repository browser" +msgstr "" + +#: aliases.kvs:20 +msgid "KVS-repository" +msgstr "" + +#: aliases.kvs:58 classes.kvs:115 classes.kvs:131 classes.kvs:141 +#: classes.kvs:277 +msgid "Info" +msgstr "" + +#: aliases.kvs:58 +msgid "List update" +msgstr "" + +#: aliases.kvs:58 classes.kvs:83 classes.kvs:115 classes.kvs:131 +#: classes.kvs:141 classes.kvs:146 classes.kvs:260 classes.kvs:277 +#: classes.kvs:293 classes.kvs:395 classes.kvs:405 +msgid "Ok" +msgstr "" + +#: classes.kvs:14 +msgid "Name" +msgstr "" + +#: classes.kvs:16 +msgid "Installed version" +msgstr "" + +#: classes.kvs:17 +msgid "Last version" +msgstr "" + +#: classes.kvs:18 +msgid "Date" +msgstr "" + +#: classes.kvs:33 +msgid "Install" +msgstr "" + +#: classes.kvs:37 +msgid "Update addon" +msgstr "" + +#: classes.kvs:46 +msgid "Uninstall" +msgstr "" + +#: classes.kvs:50 +msgid "Full uninstall" +msgstr "" + +#: classes.kvs:83 classes.kvs:146 classes.kvs:260 classes.kvs:293 +#: classes.kvs:395 classes.kvs:405 +msgid "Warning" +msgstr "" + +#: classes.kvs:83 +msgid "I can not remove yourself!!!" +msgstr "" + +#: classes.kvs:115 classes.kvs:131 +msgid "Addon installed" +msgstr "" + +#: classes.kvs:141 +msgid "Addon already installed" +msgstr "" + +#: classes.kvs:146 +msgid "I can not install yourself!!!" +msgstr "" + +#: classes.kvs:157 classes.kvs:206 +msgid "Name:" +msgstr "" + +#: classes.kvs:162 classes.kvs:211 +msgid "Last version:" +msgstr "" + +#: classes.kvs:167 classes.kvs:216 +msgid "Description:" +msgstr "" + +#: classes.kvs:172 classes.kvs:221 +msgid "Minimal version KVIrc:" +msgstr "" + +#: classes.kvs:177 classes.kvs:226 +msgid "Author:" +msgstr "" + +#: classes.kvs:182 classes.kvs:231 +msgid "Last update:" +msgstr "" + +#: classes.kvs:277 +msgid "You have already installed the latest version of the script" +msgstr "" + +#: classes.kvs:293 classes.kvs:395 +msgid "Please select a folder!" +msgstr "" + +#: classes.kvs:301 +msgid "KVS-repository settings" +msgstr "" + +#: classes.kvs:316 +msgid "URL repository" +msgstr "" + +#: classes.kvs:327 +msgid "Version KVIrc" +msgstr "" + +#: classes.kvs:335 +msgid "Local cache" +msgstr "" + +#: classes.kvs:347 +msgid "Save" +msgstr "" + +#: classes.kvs:351 +msgid "Cancel" +msgstr "" + +#: classes.kvs:405 +msgid "Path can not be empty!" +msgstr "" diff --git a/repository_browser/locale/repository_browser_ru.mo b/repository_browser/locale/repository_browser_ru.mo new file mode 100755 index 0000000..0e87f3b Binary files /dev/null and b/repository_browser/locale/repository_browser_ru.mo differ diff --git a/repository_browser/locale/repository_browser_ru.po b/repository_browser/locale/repository_browser_ru.po new file mode 100755 index 0000000..d8422bb --- /dev/null +++ b/repository_browser/locale/repository_browser_ru.po @@ -0,0 +1,160 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Alex A. Zharchenko, 2013. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-18 17:11+0400\n" +"PO-Revision-Date: 2013-02-18 17:24+0400\n" +"Last-Translator: Alex A. Zharchenko\n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<" +"=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Lokalize 1.4\n" + +#: actions.kvs:1 +msgid "Repository browser" +msgstr "" + +#: actions.kvs:1 +msgid "Open repository browser" +msgstr "Открыть просмотр хранилища" + +#: aliases.kvs:20 +msgid "KVS-repository" +msgstr "KVS-хранилище" + +#: aliases.kvs:58 classes.kvs:115 classes.kvs:131 classes.kvs:141 +#: classes.kvs:277 +msgid "Info" +msgstr "Инфо" + +#: aliases.kvs:58 +msgid "List update" +msgstr "Список обновлён" + +#: aliases.kvs:58 classes.kvs:83 classes.kvs:115 classes.kvs:131 +#: classes.kvs:141 classes.kvs:146 classes.kvs:260 classes.kvs:277 +#: classes.kvs:293 classes.kvs:395 classes.kvs:405 +msgid "Ok" +msgstr "Да " + +#: classes.kvs:14 +msgid "Name" +msgstr "Название" + +#: classes.kvs:16 +msgid "Installed version" +msgstr "Установленная версия" + +#: classes.kvs:17 +msgid "Last version" +msgstr "Последняя версия" + +#: classes.kvs:18 +msgid "Date" +msgstr "Дата" + +#: classes.kvs:33 +msgid "Install" +msgstr "Установить" + +#: classes.kvs:37 +msgid "Update addon" +msgstr "Обновить дополнение" + +#: classes.kvs:46 +msgid "Uninstall" +msgstr "Удалить" + +#: classes.kvs:50 +msgid "Full uninstall" +msgstr "Удалить полностью" + +#: classes.kvs:83 classes.kvs:146 classes.kvs:260 classes.kvs:293 +#: classes.kvs:395 classes.kvs:405 +msgid "Warning" +msgstr "Внимание" + +#: classes.kvs:83 +msgid "I can not remove yourself!!!" +msgstr "Я не могу удалить себя!!!" + +#: classes.kvs:115 classes.kvs:131 +msgid "Addon installed" +msgstr "Дополнение установлено" + +#: classes.kvs:141 +msgid "Addon already installed" +msgstr "Дополнение уже установлено" + +#: classes.kvs:146 +msgid "I can not install yourself!!!" +msgstr "Я не могу устанавливать сам себя!!!" + +#: classes.kvs:157 classes.kvs:206 +msgid "Name:" +msgstr "Название:" + +#: classes.kvs:162 classes.kvs:211 +msgid "Last version:" +msgstr "Последняя версия:" + +#: classes.kvs:167 classes.kvs:216 +msgid "Description:" +msgstr "Описание:" + +#: classes.kvs:172 classes.kvs:221 +msgid "Minimal version KVIrc:" +msgstr "Минимальная версия KVIrc:" + +#: classes.kvs:177 classes.kvs:226 +msgid "Author:" +msgstr "Автор:" + +#: classes.kvs:182 classes.kvs:231 +msgid "Last update:" +msgstr "Последнее обновление:" + +#: classes.kvs:277 +msgid "You have already installed the latest version of the script" +msgstr "Вы уже имеете установленную последнюю версию скрипта!!!" + +#: classes.kvs:293 classes.kvs:395 +msgid "Please select a folder!" +msgstr "Пожалуйста выберите папку!" + +#: classes.kvs:301 +msgid "KVS-repository settings" +msgstr "KVS-repository настройки" + +#: classes.kvs:316 +msgid "URL repository" +msgstr "URL хранилища" + +#: classes.kvs:327 +msgid "Version KVIrc" +msgstr "Версия KVIrc" + +#: classes.kvs:335 +msgid "Local cache" +msgstr "Локальный кэш" + +#: classes.kvs:347 +msgid "Save" +msgstr "Сохранить" + +#: classes.kvs:351 +msgid "Cancel" +msgstr "Отмена" + +#: classes.kvs:405 +msgid "Path can not be empty!" +msgstr "Путь не может быть пустым!" + diff --git a/repository_browser/pics/PaxHeader/rp_ok.png b/repository_browser/pics/PaxHeader/rp_ok.png new file mode 100755 index 0000000..fb34066 --- /dev/null +++ b/repository_browser/pics/PaxHeader/rp_ok.png @@ -0,0 +1,3 @@ +30 mtime=1478293870.072159051 +120 LIBARCHIVE.xattr.user.xdg.referrer.url=aHR0cDovL3d3dy5mbGF0aWNvbi5jb20vZnJlZS1pY29uL3ZlcmlmaWNhdGlvbi1tYXJrXzYwNTE2 +91 LIBARCHIVE.xattr.user.xdg.origin.url=aHR0cDovL3d3dy5mbGF0aWNvbi5jb20vZG93bmxvYWQtaWNvbg diff --git a/repository_browser/pics/PaxHeader/rp_refresh.png b/repository_browser/pics/PaxHeader/rp_refresh.png new file mode 100755 index 0000000..ce540c4 --- /dev/null +++ b/repository_browser/pics/PaxHeader/rp_refresh.png @@ -0,0 +1,3 @@ +30 mtime=1478293829.845229377 +108 LIBARCHIVE.xattr.user.xdg.referrer.url=aHR0cDovL3d3dy5mbGF0aWNvbi5jb20vZnJlZS1pY29uL2xvYWRpbmdfMTA5NDAy +91 LIBARCHIVE.xattr.user.xdg.origin.url=aHR0cDovL3d3dy5mbGF0aWNvbi5jb20vZG93bmxvYWQtaWNvbg diff --git a/repository_browser/pics/rp_button.png b/repository_browser/pics/rp_button.png new file mode 100755 index 0000000..0f328e2 Binary files /dev/null and b/repository_browser/pics/rp_button.png differ diff --git a/repository_browser/pics/rp_ok.png b/repository_browser/pics/rp_ok.png new file mode 100755 index 0000000..3c3d226 Binary files /dev/null and b/repository_browser/pics/rp_ok.png differ diff --git a/repository_browser/pics/rp_refresh.png b/repository_browser/pics/rp_refresh.png new file mode 100755 index 0000000..db35453 Binary files /dev/null and b/repository_browser/pics/rp_refresh.png differ diff --git a/repository_browser/src/actions.kvs b/repository_browser/src/actions.kvs new file mode 100755 index 0000000..73a9064 --- /dev/null +++ b/repository_browser/src/actions.kvs @@ -0,0 +1,10 @@ +action.create -t=generic ("open_repository",$tr("Repository browser",repository_browser),$tr("Open repository browser",repository_browser),"repository_browser/rp_button.png","repository_browser/rp_button.png") +{ + if($objects.exists(%Rep_main)){ + %Rep_main->$raise(); + %Rep_main->$setFocus(); + } else { + repository_browser::main + } +} + diff --git a/repository_browser/src/aliases.kvs b/repository_browser/src/aliases.kvs new file mode 100755 index 0000000..23b4bc4 --- /dev/null +++ b/repository_browser/src/aliases.kvs @@ -0,0 +1,73 @@ +alias(repository_browser::checker) +{ + %time = $0; + %sw = $1; + %time = $(%time * 60000); + //%time = $(%time * 1000); + if(%sw == 1){ + if($isTimer(browser)){ + // debug if timer + killtimer browser; + timer(browser,%time){ + repository_browser::updateList + } + } else { + // debug else timer + timer(browser,%time){ + repository_browser::updateList + } + } + } else { + // debug switch 0 + if($isTimer(browser)){ + killtimer browser; + } + repository_browser::updateList(); + } +} + + +alias(repository_browser::init) +{ + %rep = "$file.localdir/config/repository_browser" + %cfg=$config.open(%rep/rep_cfg.kvc) + config.setsection %cfg "Main" + %period = $config.read(%cfg,CurrentPeriod); + %switch = $config.read(%cfg,AutoUpdateList); + config.close %cfg + // debug "period -- %period"; + // debug "switch -- %switch"; + $repository_browser::checker(%period,%switch); +} + + +alias(repository_browser::main) +{ + %Rep_main = $new(repository_browser::main) +} + + +alias(repository_browser::settings) +{ + %Set = $new(repository_browser::settings) +} + + +alias(repository_browser::updateList) +{ + %rep = "$file.localdir/config/repository_browser" + %cfg=$config.open(%rep/rep_cfg.kvc) + config.setsection %cfg "Main" + %currentUrl = $config.read(%cfg,CurrentUrl) + %ver = $config.read(%cfg,Version) + %n = $str.split(".",%ver) + %verM = %n[0] + config.close %cfg + + http.asyncGet -y -с -e=o -w=h (%currentUrl/dists/%verM/rep_info.xml,%rep/rep_info.xml) + { + // notifier.message -t=5 $tr("List updated",repository_browser) + } +} + + diff --git a/repository_browser/src/classes.kvs b/repository_browser/src/classes.kvs new file mode 100755 index 0000000..01b19c1 --- /dev/null +++ b/repository_browser/src/classes.kvs @@ -0,0 +1,894 @@ +class("repository_browser::xmlparser","xmlreader") +{ + function parse() + { + if ($0 == "") + { + debug "[repository_browser::xmlparser] The name of the file to parse was not specified" + return $false + } + if (!$file.exists($0)) + { + debug "[repository_browser::xmlparser] The file to parse was not found" + return $false + } + if(!$$->$xmlreader::parse($file.read($0))) + { + debug "[repository_browser::xmlparser] Critical error: $$->$xmlreader::lastError()" + return $false; + } + else + { + return @%stations + debug @%stations + } + } + + internal function onWarning() + { + warning $0 + return $true; + } + + internal function onText() + { + // debug $0 + %text = $0; + //Trim leading and trailing space characters + %text = $str.strip(%text) + if (%text) + { + if (@%currentkey == n) + { + %text =~ s/^\///g + } + // debug @%currentindex : \"%text\" + @%stations[@%currentindex]{@%currentkey} = %text + } + return $true; + } + + internal function onElementStart() + { + if ($0 == repository) return $true + if ($0 != addon) + { + @%currentkey = $0 + // debug @%currentkey + } + return $true; + } + + internal function onElementEnd() + { + //debug + if ($0 == addon) @%currentindex++ + return $true; + } + + internal function onDocumentStart() + { + @%stations = $array(); + @%currentindex = 0; + return $true; + } + + internal function onDocumentEnd() + { + return $true + } + +} + +class("repository_browser::settings","dialog") +{ + function switch() + { + if(@%ckbAutoUpdateList->$isChecked()){ + @%cbAutoUpdateListPeriod->$setEnabled(1) + }else{ + @%cbAutoUpdateListPeriod->$setEnabled(0) + } + } + + function selectDir() + { + dialog.file(dir,Choose addon folder,,"All files (*.*)") + { + if($0 == "") + { + dialog.message($tr("Warning",repository_browser),$tr("Path can not be empty!",repository_browser),warning,$tr("Close",repository_browser)){} + } + else + { + %Set->%leCache->$setText($0) + } + } + } + + function save() + { + if($str.match("/*",@%leCache->$text())){ + %cfg=$config.open(%Rep/rep_cfg.kvc) + config.setsection %cfg "Main" + config.write %cfg UrlList %UrlList + config.write %cfg CurrentUrl @%cbUrl->$current(); + config.write %cfg CurrentPeriod @%cbAutoUpdateListPeriod->$current(); + config.write %cfg Version @%leVersion->$text(); + config.write %cfg Cache @%leCache->$text(); + config.write %cfg AutoUpdateList @%ckbAutoUpdateList->$isChecked(); + config.close %cfg + + @$getParams(); + repository_browser::init + @$close(); + }else{ + dialog.message($tr("Warning",repository_browser),$tr("Please select a folder!",repository_browser),warning,$tr("Close",repository_browser)){} + } + } + + function itemSelected() + { + %CurrentUrl = @%cbUrl->$current() + } + + function getParams() + { + %Rep = "$file.localdir/config/repository_browser" + %cfg=$config.open(%Rep/rep_cfg.kvc); + config.setsection %cfg "Main" + %CurrentUrl = $config.read(%cfg,CurrentUrl); + %UrlList = $config.read(%cfg,UrlList); + %Ver = $config.read(%cfg,Version); + %AutoUpdateList = $config.read(%cfg,AutoUpdateList) + %PeriodsList = $config.read(%cfg,PeriodsList); + %CurrentPeriod = $config.read(%cfg,CurrentPeriod); + %Cache = $config.read(%cfg,Cache); + %n = $str.split(".",%Ver); + %VerM = %n[0] + config.close %cfg + } + + function constructor() + { + @$getParams(); + @%urllist = $str.split(",",%UrlList); + @%periodsList = $str.split(",",%PeriodsList); + + @$setWindowTitle($tr("KVS-repository settings",repository_browser)); + @$setMinimumWidth(300); + @$setMaximumWidth(300); + @$setWFlags(Dialog); + @$centerToScreen(); + + %l = $new(layout,$$); + %l->$setMargin(5); + %l->$setSpacing(0); + %l->$setColumnStretch(0,4); + %l->$setColumnStretch(1,1); + %l->$setColumnStretch(2,0); + + %l->$setRowStretch(0,1); + %l->$setRowStretch(1,1); + %l->$setRowStretch(2,1); + %l->$setRowStretch(3,2); + + %hb = $new(hbox,$$); + %hb->$setMargin(0); + %hb->$setSpacing(0); + %l->$addmulticellwidget(%hb,5,5,0,2); + + @%lbUrl = $new(label,$$); + @%lbUrl->$setMinimumHeight(30); + @%lbUrl->$setText($tr("URL repository",repository_browser)); + %l->$addwidget(@%lbUrl,0,0); + + @%cbUrl = $new(combobox,$$) + @%cbUrl->$setToolTip("Test tooltip"); + for(%i = 0;%i < $length(@%urllist);%i++){ + @%cbUrl->$insertItem("@%urllist[%i]") + if(@%urllist[%i] == %CurrentUrl){ + @%cbUrl->$setCurrentItem(%i) + } + } + %l->$addmulticellwidget(@%cbUrl,0,0,1,2); + + @%lbVersion = $new(label,$$) + @%lbVersion->$setMinimumHeight(30); + @%lbVersion->$setText($tr("Version KVIrc",repository_browser)) + %l->$addwidget(@%lbVersion,1,0); + + @%leVersion = $new(lineedit,$$) + @%leVersion->$setText("%Ver") + %l->$addmulticellwidget(@%leVersion,1,1,1,2); + + @%lbCache = $new(label,$$) + @%lbCache->$setMinimumHeight(30); + @%lbCache->$setText($tr("Local cache",repository_browser)) + %l->$addwidget(@%lbCache,2,0); + + @%leCache = $new(lineedit,$$) + @%leCache->$setText("%Cache") + %l->$addwidget(@%leCache,2,1); + + @%btCacheDir = $new(button,$$) + @%btCacheDir->$setImage(106) + %l->$addwidget(@%btCacheDir,2,2); + + @%lbAutoUpdateList = $new(label,$$) + @%lbAutoUpdateList->$setMinimumHeight(30); + @%lbAutoUpdateList->$setText($tr("Autoupdate list",repository_browser)) + %l->$addwidget(@%lbAutoUpdateList,3,0); + + @%ckbAutoUpdateList = $new(checkbox,$$); + if(%AutoUpdateList == 1){ + @%ckbAutoUpdateList->$setChecked(1); + } + %l->$addwidget(@%ckbAutoUpdateList,3,2); + + @%cbAutoUpdateListPeriod = $new(combobox,$$) + for(%i = 0;%i < $length(@%periodsList);%i++){ + @%cbAutoUpdateListPeriod->$insertItem("@%periodsList[%i]"); + if(@%periodsList[%i] == %CurrentPeriod){ + @%cbAutoUpdateListPeriod->$setCurrentItem(%i) + } + } + if(@%ckbAutoUpdateList->$isChecked()){ + @%cbAutoUpdateListPeriod->$setEnabled(1) + } else { + @%cbAutoUpdateListPeriod->$setEnabled(0) + } + %l->$addMultiCellWidget(@%cbAutoUpdateListPeriod,4,4,1,2); + objects.connect @%ckbAutoUpdateList "toggled" $$ switch + + @%btSave = $new(button, %hb) + @%btSave->$setText($tr("Save",repository_browser)) + + + @%btCancel = $new(button, %hb) + @%btCancel->$setText($tr("Cancel",repository_browser)) + + objects.connect @%btCacheDir "clicked" $$ selectDir + objects.connect @%btSave "clicked" $$ save + objects.connect @%btCancel "clicked" $$ close + + @$show() + } + + function closeEvent() + { + } + + function close() + { + if($str.match("/*",@%leCache->$text())){ + if(!$objects.exists(%Rep_main)){ + unset %Set,%CurrentUrl,%UrlList,%Ver,%Cache,%VerM,%Rep,%AutoUpdateList,%PeriodsList,%CurrentPeriod + } + delete $$ + }else{ + dialog.message($tr("Warning",repository_browser),$tr("Please select a folder!",repository_browser),warning,$tr("Close",repository_browser)){} + } + } + +} + +class("repository_browser::main","widget") +{ + function settings() + { + if($objects.exists(%Set)){ + %Set->$show(); + } else { + repository_browser::settings + } + } + + function getParams() + { + %Rep = "$file.localdir/config/repository_browser" + %cfg=$config.open(%Rep/rep_cfg.kvc) + config.setsection %cfg "Main" + %CurrentUrl = $config.read(%cfg,CurrentUrl) + %UrlList = $config.read(%cfg,UrlList) + %Ver = $config.read(%cfg,Version) + %AutoUpdateList = $config.read(%cfg,AutoUpdateList) + %Cache = $config.read(%cfg,Cache) + %n = $str.split(".",%Ver) + %VerM = %n[0] + config.close %cfg + } + + function getList() + { + http.asyncGet -y -с -e=o -w=h (%CurrentUrl/dists/%VerM/rep_info.xml,%Rep/rep_info.xml) + { + %Lst->$refresh() + dialog.message($tr("Info",repository_browser),$tr("List update",repository_browser),information,$tr("Ok")){} + } + } + + function constructor() + { + @$getParams() + if(%Cache == "") + { + @$settings() + } + else + { + @$setMinimumWidth(1000) + @$setMinimumHeight(500) + @$setWindowTitle($tr("KVIrc scripts repository browser $addon.version(repository_browser)",repository_browser)) + @$centerToScreen() + + %l = $new(layout,$$); + %l->$setMargin(0) + %l->$setSpacing(0) + + %hb = $new(hbox,$$); + %hb->$setMargin(0) + %hb->$setSpacing(0) + %l->$addwidget(%hb,0,0) + %l->$setAlignment(%hb,left) + + @%btReload = $new(toolbutton,%hb) + @%btReload->$setImage(292) + %hb->$setAlignment(@%btReload,left) + objects.connect @%btReload "clicked" $$ getList + + @%btSettings = $new(toolbutton,%hb) + @%btSettings->$setImage(20) + objects.connect @%btSettings "clicked" $$ settings + + @%btHelp = $new(toolbutton,%hb) + @%btHelp->$setImage(50) + + %Lst=$new(repository_browser::list,); + %l->$addwidget(%Lst,1,0); + @$show() + } + } + + function closeEvent() + { + unset %Lst,%Set,%CurrentUrl,%UrlList,%Ver,%Cache,%VerM,%Rep,%S_name,%Package,%Gr,%AutoUpdateList,%Rep_main,%PeriodsList,%CurrentPeriod + } + +} + +class("repository_browser::list","widget") +{ + function update() + { + if($addon.exists(@%name) && $int($str.replace($addon.version(@%name),".","")) < $int($str.replace(@%data[%Id]{version},".",""))) + { + if(@%name != "repository_browser") + { + @$fulluninstall() + @$install() + + } + } + else + { + dialog.message($tr("Info",repository_browser),$tr("You have already installed the latest version of the script",repository_browser),information,$tr("Close",repository_browser)){} + } + } + + function uninstall() + { + %S_name = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + %Package = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + if($system.osname == "Linux"){ + if(@%name != "repository_browser") + { + exec("rm -Rf %Cache/%S_name"){}; + if($addon.exists(@%name)) + { + addon.uninstall @%name + } + @$refresh(); + } + else + { + dialog.message($tr("Warning","I can not remove myself!!!",repository_browser),warning,$tr("Close",repository_browser)){} + } + } + if($system.osname == "Windows"){ + if(@%name != "repository_browser") + { + %S_name = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + %Package = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + if($addon.exists(@%name)) + { + addon.uninstall @%name + if($file.exists(%Cache/%S_name)) + { + %txt <+ "cd %Cache" + %txt <+ "rmdir /s /q %S_name" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q del.bat" + file.writeLines %Cache/del.bat %txt + run %Cache/del.bat; + } + @$refresh(); + } + } + else + { + dialog.message($tr("Warning","I can not remove myself!!!",repository_browser),warning,$tr("Ok",repository_browser)){} + } + } + } + + function refresh() + { + for (%i=0; %i<$length(@%data); %i++){ + if(@%lv->$topLevelItem(%i)) { + delete @%lv->$topLevelItem(%i) + } + } + @$loadList(%Gr) + } + + function loadList() + { + if(!$0) { + %filter = "All" + } else { + %filter = %Gr + } + @%data = @$getData(); + + if(%filter == "All") { + for (%i=0; %i<$length(@%data); %i++) + { + %item = $new(listviewitem, @%lv); + %item->$setText(0, @%data[%i]{title}); + %item->$setText(1, %i); + if($addon.exists(@%data[%i]{name})){ + if($int($str.replace($addon.version(@%data[%i]{name}),".","")) == $int($str.replace(@%data[%i]{version},".",""))){ + %item->$setPixmap(2,repository_browser/rp_ok.png) + } + if($int($str.replace($addon.version(@%data[%i]{name}),".","")) < $int($str.replace(@%data[%i]{version},".",""))){ + %item->$setPixmap(2,repository_browser/rp_refresh.png) + } + } + %item->$setText(3, $addon.version(@%data[%i]{name})); + %item->$setText(4, @%data[%i]{version}); + %item->$setText(5, @%data[%i]{date}); + + } + if(!%Id) + { + %Id = 0 + } + @%name = "@%data[%Id]{name}" + @%desc->$clear() + @%desc->$setBold($true) + @%desc->$append($tr("Name:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{title}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last version:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{version}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Description:",repository_browser)) + @%desc->$setBold($false) + if(@%data[%Id]{description_$lang(short)}){ + @%desc->$append("@%data[%Id]{description_$lang(short)}") + } else { + @%desc->$append("@%data[%Id]{description}") + } + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Minimal version KVIrc:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{minimal_version_kvirc}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Author:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{author}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last update:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{date}") + } else { + for (%i=0; %i<$length(@%data); %i++) + { + if(@%data[%i]{group} == %Gr) { + %item = $new(listviewitem, @%lv); + %item->$setText(0, @%data[%i]{title}); + %item->$setText(1, %i); + if($addon.exists(@%data[%i]{name})){ + if($int($str.replace($addon.version(@%data[%i]{name}),".","")) == $int($str.replace(@%data[%i]{version},".",""))){ + %item->$setPixmap(2,repository_browser/rp_ok.png) + } + if($int($str.replace($addon.version(@%data[%i]{name}),".","")) < $int($str.replace(@%data[%i]{version},".",""))){ + %item->$setPixmap(2,repository_browser/rp_refresh.png) + } + } + %item->$setText(3, $addon.version(@%data[%i]{name})); + %item->$setText(4, @%data[%i]{version}); + %item->$setText(5, @%data[%i]{date}); + } + } + if(!%Id) + { + %Id = 0 + } + @%name = "@%data[%Id]{name}" + @%desc->$clear() + @%desc->$setBold($true) + @%desc->$append($tr("Name:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{title}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last version:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{version}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Description:",repository_browser)) + @%desc->$setBold($false) + if(@%data[%Id]{description_$lang(short)}){ + @%desc->$append("@%data[%Id]{description_$lang(short)}") + } else { + @%desc->$append("@%data[%Id]{description}") + } + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Minimal version KVIrc:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{minimal_version_kvirc}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Author:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{author}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last update:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{date}") + } + } + + function loadGroupsList() + { + for (%i=0; %i<$length(@%groups); %i++) + { + %item = $new(listviewitem, @%groupsList); + %item->$setText(0, @%groups[%i]); + %item->$setText(1, %i); + } + } + + function listviewItemSelected() + { + if (!$0) halt + %Id = $int($0->$text(1)); + @%name = "@%data[%Id]{name}" + @%desc->$clear() + @%desc->$setBold($true) + @%desc->$append($tr("Name:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{title}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last version:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{version}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Description:",repository_browser)) + @%desc->$setBold($false) + if(@%data[%Id]{description_$lang(short)}){ + @%desc->$append("@%data[%Id]{description_$lang(short)}") + } else { + @%desc->$append("@%data[%Id]{description}") + } + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Minimal version KVIrc:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{minimal_version_kvirc}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Author:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{author}") + @%desc->$append(" ") + @%desc->$setBold($true) + @%desc->$append($tr("Last update:",repository_browser)) + @%desc->$setBold($false) + @%desc->$append("@%data[%Id]{date}") + } + + function install() + { + %S_name = "@%data[%Id]{name}-@%data[%Id]{version}" + %Package = "@%data[%Id]{name}-@%data[%Id]{version}.tar.gz" + if($system.osname == "Linux"){ + if(@%data[%Id]{name} != "repository_browser"){ + if(!$addon.exists(@%data[%Id]{name})){ + if($file.exists(%Cache/%Package)){ + exec("tar zxvf %Cache/%Package -C %Cache"){}; + timer(iidl,3000){ + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + dialog.message($tr("Info",repository_browser),$tr("Addon installed",repository_browser),information,$tr("Ok",repository_browser)){} + killtimer iidl + %Lst->$refresh() + } + } + }else{ + http.asyncGet -w=h (%CurrentUrl/pool/%VerM/%Package,%Cache/%Package){ + exec("tar zxvf %Cache/%Package -C %Cache"){}; + timer(iidl,3000){ + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + dialog.message($tr("Info",repository_browser),$tr("Addon installed",repository_browser),information,$tr("Close",repository_browser)){} + killtimer iidl + %Lst->$refresh() + } + } + } + } + }else{ + dialog.message($tr("Info",repository_browser),$tr("Addon already installed",repository_browser),information,$tr("Close",repository_browser)){} + } + }else{ + if($addon.exists(repository_updater)){ + repository_updater::update + }else{ + notifier.message -t=5 -i=318 $tr("I can not install myself!!!",repository_browser) + } + } + } + if($system.osname == "Windows"){ + if(@%data[%Id]{name} != "repository_browser") + { + %txt <+ "cd \"%Cache\"" + %txt <+ "\"%Rep/7za\" x -y %Package" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "\"%Rep/7za\" x -y *.tar" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q *.tar" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q install.bat" + file.writeLines %Cache/install.bat %txt + + if(!$addon.exists(@%data[%Id]{name})){ + if($file.exists(%Cache/%Package)){ + run %Cache/install.bat; + %N = 0 + timer (iidl,1000){ + %N = $(%N +1) + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + %Lst->$refresh() + dialog.message($tr("Info",repository_browser),$tr("Addon installed",repository_browser),information,$tr("Ok",repository_browser)){} + killtimer iidl + } + if(%N == 20){ + dialog.message($tr("Warning",repository_browser),$tr("Addon not installed",repository_browser),warning,$tr("Ok",repository_browser)){} + killtimer iidl + } + } + }else{ + http.asyncGet -w=h (%CurrentUrl/pool/%VerM/%Package,%Cache/%Package){ + run %Cache/install.bat; + %N = 0 + timer (iidl,1000){ + %N = $(%N +1) + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + %Lst->$refresh() + dialog.message($tr("Info",repository_browser),$tr("Addon installed",repository_browser),information,$tr("Ok",repository_browser)){} + killtimer iidl + } + if(%N == 20){ + dialog.message($tr("Warning",repository_browser),$tr("Addon not installed",repository_browser),warning,$tr("Ok",repository_browser)){} + killtimer iidl + } + } + } + } + }else{ + dialog.message($tr("Info",repository_browser),$tr("Addon already installed",repository_browser),information,$tr("Ok",repository_browser)){} + } + }else{ + if($addon.exists(repository_updater)){ + repository_updater::update + }else{ + notifier.message -t=5 -i=318 $tr("I can not install myself!!!",repository_browser) + } + } + } + } + + function groupsListItemSelected() + { + if (!$0) halt + %Gr = $0->$text(0); + %Lst->$refresh(); + } + + function getGroups() + { + /* + * %cfg=$config.open(%Rep/rep_cfg.kvc) + * config.setsection %cfg "Main" + * @%groups = $config.read(%cfg,Groups) + * config.close %cfg + * @%groups = $str.split(",",@%groups) + */ + @%groups = $array("All"); + @%data = @$getData(); + for(%i=0; %i<$length(@%data); %i++) { + %match = 0; + foreach(%y,@%groups) { + if(%y == @%data[%i]{group}) { + %match++ + } + } + if(%match == 0){ + @%groups <+ @%data[%i]{group}; + } + } + } + + function getData() + { + %xml = $new(repository_browser::xmlparser); + %addons = %xml->$parse("$file.localdir/config/repository_browser/rep_info.xml") + if (!%addons) + { + debug "[repository_browser::xmlparser] Error while parsing xml-file $0" + return + } + return %addons; + } + + function fulluninstall() + { + if($system.osname == "Linux"){ + %s_name = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + %package = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name}).tar.gz" + %package1 = "@%data[%Id]{name}-@%data[%Id]{version}.tar.gz" + if(@%name != "repository_browser") + { + if($file.exists(%Cache/%s_name)) + { + exec("rm -Rf %Cache/%s_name"){}; + } + if($file.exists(%Cache/%package)) + { + exec("rm -Rf %Cache/%package"){}; + } + if($file.exists(%Cache/%package1)) + { + exec("rm -Rf %Cache/%package1"){}; + } + if($addon.exists(@%name)) + { + addon.uninstall @%name + } + @$refresh() + } + else + { + dialog.message($tr("Warning",repository_browser),$tr("I can not remove myself!!!",repository_browser),warning,$tr("Close",repository_browser)){} + } + } + if($system.osname == "Windows"){ + if(@%name != "repository_browser") + { + %S_name = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name})" + %Package = "@%data[%Id]{name}-$addon.version(@%data[%Id]{name}).tar.gz" + if($addon.exists(@%name)) + { + addon.uninstall @%name + if($file.exists(%Cache/%S_name)) + { + %txt <+ "cd %Cache" + %txt <+ "rmdir /s /q %S_name" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q del.bat" + file.writeLines %Cache/del.bat %txt + run %Cache/del.bat; + } + if($file.exists(%Cache/%Package)) + { + file.remove %Cache/%Package + } + @$refresh(); + } + } + else + { + dialog.message($tr("Warning","I can not remove myself!!!",repository_browser),warning,$tr("Ok",repository_browser)){} + } + } + } + + function constructor() + { + %l = $new(layout,$$); + %l->$setMargin(3) + %l->$setSpacing(3) + %l->$setColumnStretch(0,1) + %l->$setColumnStretch(1,4) + %l->$setRowStretch(0,2) + %l->$setRowStretch(1,2) + %l->$setRowStretch(3,0) + + // Build list of groups + @%groupsList=$new(listview,$$) + @%groupsList->$setAllColumnsShowFocus($true) + @%groupsList->$hideListViewHeader() + @%groupsList->$addcolumn($tr("Name",repository_browser), 0); + @%groupsList->$setSortingEnabled(true) + @%groupsList->$setSorting(0,"ascending") + %l->$addmulticellwidget(@%groupsList,0,1,0,0) + objects.connect @%groupsList "selectionChanged" $$ groupsListItemSelected + objects.connect @%groupsList "clicked" $$ groupsListItemSelected + + //Build list of apps + @%lv=$new(listview,$$) + @%lv->$setAllColumnsShowFocus($true) + @%lv->$addcolumn($tr("Name",repository_browser), 300); + @%lv->$addcolumn(id, 1); + @%lv->$addcolumn($tr("",repository_browser), 32); + @%lv->$addcolumn($tr("Installed version",repository_browser), 150); + @%lv->$addcolumn($tr("Last version",repository_browser), 150); + @%lv->$addcolumn($tr("Date",repository_browser), 100); + @%lv->$setSortingEnabled(true) + @%lv->$setSorting(0,"ascending") + %l->$addwidget(@%lv,0,1); + objects.connect @%lv "selectionChanged" $$ listviewItemSelected + objects.connect @%lv "clicked" $$ listviewItemSelected + + // Build multilineedit for app description + @%desc=$new(multilineedit,$$); + @%desc->$setReadOnly($true); + %l->$addmulticellwidget(@%desc,1,2,1,1); + + // Build horizontal box for buttons + %hb = $new(hbox,$$); + %hb->$setMargin(0) + %hb->$setSpacing(0) + %l->$addmulticellwidget(%hb,3,3,0,1) + + @%btInstall=$new(button,%hb) + @%btInstall->$setText($tr("Install",repository_browser)) + objects.connect @%btInstall "clicked" $$ install + + @%btUpdate=$new(button,%hb) + @%btUpdate->$setText($tr("Update addon",repository_browser)) + objects.connect @%btUpdate "clicked" $$ update + + @%btUninstall=$new(button,%hb) + @%btUninstall->$setText($tr("Uninstall",repository_browser)) + objects.connect @%btUnInstall "clicked" $$ uninstall + + @%btFullUninstall=$new(button,%hb) + @%btFullUninstall->$setText($tr("Full uninstall",repository_browser)) + @%btFullUninstall->$setToolTip("Uninstall addon and remove addon's files") + objects.connect @%btFullUnInstall "clicked" $$ fulluninstall + + @$getGroups(); + @$loadGroupsList(); + @$loadList(); + } + +} + diff --git a/repository_browser/src/events.kvs b/repository_browser/src/events.kvs new file mode 100644 index 0000000..5b5c2ce --- /dev/null +++ b/repository_browser/src/events.kvs @@ -0,0 +1,5 @@ +event(OnKVIrcStartup,repository_updater) +{ + repository_updater::init +} + diff --git a/repository_browser/src/toolbars.kvs b/repository_browser/src/toolbars.kvs new file mode 100755 index 0000000..b4d43da --- /dev/null +++ b/repository_browser/src/toolbars.kvs @@ -0,0 +1,3 @@ +toolbar.create repo Repository "repository_browser/rp_button.png" +toolbar.additem repo open_repository +toolbar.show repo diff --git a/repository_browser/utils/installer.kvs b/repository_browser/utils/installer.kvs new file mode 100755 index 0000000..62cd0e1 --- /dev/null +++ b/repository_browser/utils/installer.kvs @@ -0,0 +1,184 @@ +/* + A helper class for installing and parsing files, + and generating an uninstallation alias on the fly. + + Example : + include "utils/installer.kvs" + %installer = $new(installer,0,myinstaller) + %installer->$copyFiles(pics,*.png,$file.localdir(pics)) + %installer->$includeFiles(src,*.kvs) + %installer->generateUninstallAlias("foo::uninstall") + delete %installer + Here, "foo::uninstall" must be called in you uninstall + callback script. + + Warnings: + 1) Declaration of aliases, popups, etc, in source files + (.kvs) must be in a similar format + as when you export them directly from kvirc. + Example: + alias(myalias) + defpopup(mypopup) + 2) If you use a "defpopup -m" to add an item to an + existing popup,this item won't be registered + automatically for uninstallation by this installer script. + You should typically identify the item you added using + the "id" parameter. See this example where the id is + "myaddon::myitem": + defpopup -m (channeltextview) + { + item(MyItem)(myaddon::myitem) + { + ... + } + } + Then, you add this line to you uninstall callback + script: + delpopupitem channeltextview myaddon::myitem +*/ +class(installer,object) +{ + constructor() + { + } + + copyFiles($0 = source dir,$1 = file regexp,$2 = target dir) + { + if(!$file.exists($0))return + if($isempty($0)) + { + echo $tr("[Installer] The first argument to \%installer->\$copyfiles must be a source directory") + halt + } + + if($isempty($1)) + { + echo $tr("[Installer] The second argument to \%installer->\$copyfiles must be a file name or file regexp") + halt + } + + if($isempty($2)) + { + echo $tr("[Installer] The third argument to \%installer->\$copyfiles must be a destination directory") + halt + } + + if($file.exists($0)) + { + %files = $file.ls($file.fixpath($0),f,$1) + if($length(%files)) + { + @$mkdir($2) + foreach(%file,%files) + { + $this->%lFiles <+ $str.replace($file.fixpath("$2/%file"),"\\\\","\\") + file.copy -o $file.fixpath($0/%file) $file.fixpath($2/%file) + } + } + } + } + + // Recursive creation of directory + mkdir($0 = directory) + { + if($isempty($0) || $file.exists($0)) return + foreach -a (%subdir,$str.split("/",$file.fixpath($0))) + { + %p <+ %subdir + %path = $str.join("/",%p) + if(!$file.exists(%path)) + file.mkdir -q %path + } + if(!$file.exists($0)) + { + echo $tr("[Installer] Failed to create directory") \"$0\" + return + } + } + + // Parse source files and get what will need to be uninstalled + includeFiles($0 = dir, $1 = file regexp) + { + if($isempty($0)) + { + echo $tr("[Installer] The first argument to \%installer->\$includefiles must be a source directory") + halt + } + + @$mkdir($0) + + if($1 == "") + %szRe = "*.kvs" + else + %szRe = $1 + + %files = $file.ls($file.extractpath($0),f,$1) + if($length(%files)) + { + foreach(%file,%files) + { + $this->%lSources <+ $str.replace($file.fixpath("$0/%file"),"\\\\","\\") + include $file.fixpath("$0/%file") + } + } + } + + + generateUninstallAlias($0 = alias name) + { + %c = "alias($0)$lf" + %c .= "{$lf" + if($isset($this->%lFiles)) + { + %d = "" + foreach(%file,$this->%lFiles) + { +// %file =~ s/"^$file.localdir()/(.*)$"/"\$file.localdir(\\1)"/ + %file = $str.replace(%file,"\\","/") + %c .= "file.remove -q \"%file\"$lf"; + if(%d != $file.extractpath(%file)) + { + %d = $file.extractpath(%file) + %u .= "file.rmdir -q \"%d\"$lf"; + } + } + %c .= %u + } + + if($isset($this->%lSources)) + { + foreach(%file,$this->%lSources){ + foreach(%line,$file.readlines(%file)) + if(!$str.isempty(%line)){ + if($str.match("*extpopup(*)",%line,e)){ + %s = $str.split(",",%line) + %s = $str.split(")",%s[$($length(%s) - 1)]) + %s = $str.split(".",%s[0]) + %c .= "delpopupitem -d "%s[0] %s[0].%s[1]"$lf" + } + if($str.match("event(*)*",%line,e)) + %c .= "eventctl -u "$str.token(1,"(,)",%line) $str.token(2,"(,)",%line)"$lf" + else if($str.match("alias(*)",%line,e)) + %aliases<+$str.token(1,"()",%line) + else if($str.match("defpopup(*)",%line,e)) + %c .= "defpopup("$str.token(1,"()",%line)"){}$lf" + else if($str.match("toolbar.create * *",%line,e)) + %c .= "toolbar.destroy -q "$str.word(1,%line)"$lf" + else if($str.match("action.create* (*)",%line,e)) + %c .= "action.destroy -q "$str.replace($str.token(1,"(,)",%line),\","")"$lf" + else if($str.match("class(*)*",%line,e)) + %c .= "objects.killclass -q "$str.token(1,"(,)",%line)"$lf" + } + } + if($isset(%aliases)) + foreach(%alias,%aliases) + %c .= "alias -q (%alias){}$lf" + %c .= "alias -q ($0){}$lf" + } + %c .= "}" + eval %c + } +} + + + diff --git a/repository_updater/config/7za.exe b/repository_updater/config/7za.exe new file mode 100644 index 0000000..772e703 Binary files /dev/null and b/repository_updater/config/7za.exe differ diff --git a/repository_updater/config/rep_info.xml b/repository_updater/config/rep_info.xml new file mode 100644 index 0000000..86dee50 --- /dev/null +++ b/repository_updater/config/rep_info.xml @@ -0,0 +1,338 @@ + + + + Hush + 0.2.2 + Hush + XDCC passive search system. + Пассивная XDCC система поиска. + 4.2.0 + 28.12.2016 + hush + Internet + 0 + + + repository_browser + 3.0.6 + Repository browser + Браузер репозитория. + Repository browser. + 4.2.0 + 13.01.2017 + alexzulu + Tools + 1 + + + repository_browser + 3.0.4 + Repository browser + Repository browser. + Браузер репозитория. + 4.2.0 + 12.01.2017 + alexzulu + Old version + 1 + + + gen_installer + 3.0.0 + Install.kvs generator + The script to automatically create an installer file install.kvs. + Скрипт для автоматического создания файла установки install.kvs. + 4.2.0 + 06.11.2016 + alexzulu + Tools + 1 + + + bookmarks + 2.0.0 + Bookmarks + Keep your bookmarks and manage. + Создавайте закладки на интересные каналы и управляйте ими. + 4.2.0 + 05.11.2016 + alexzulu + Tools + 1 + + + hellmediaplayer + 0.1.0 + Hell Mediaplayer + Простой скрипт для объявления проигрываемых композиций. + A simple script for announcing mp3s that are played by someone. + 4.0.2 + 04.11.2016 + HelLViS69 + Multimedia + 0 + + + newsticker + 2.0.0 + Newsticker: The RSS News Reader + Displays RSS news feeds from various sources. Updated for KVIrc 4.2.0. + Просматривайте новостные RSS-ленты из различных источников. Обновлено для KVIrc 4.2.0 + 4.2.0 + 14.10.2016 + Szymon Stefanek(Pragma) + Internet + 0 + + + minesweeper + 1.1.0 + Minesweeper Game + A nice "time eater" + Прекрасный "пожиратель времени" + 4.2.0 + 12.10.2016 + Szymon Stefanek(Pragma) + Games + 1 + + + auto_away + 2.0.2 + Auto away + Upgraded auto away. + Обновлённый автоэвэй. + 4.2.0 + 11.10.2016 + alexzulu + Tools + 0 + + + SysInfo + 1.2.2 + SysInfo + SysInfo alias. + Просмотр и показ системной информации. + 4.4.2 + 29.09.2016 + un1versal + Tools + 0 + + + znctool + 0.1.0 + ZNC tool + Menu for ZNC bouncer. + Меню для управления ZNC. + 4.0.0 + 17.02.2013 + Prof. BiG BanG + Tools + 0 + + + player_control + 1.0.2 + The player control + Player control script with the custom string display the currently playing song in the channel. + Скрипт управления проигрывателя с настраиваемой строкой отображения проигрываемой композиции в канал. + 4.0.2 + 22.12.2014 + alexzulu + Multimedia + 0 + + + pastebin + 0.0.1 + Pastebin.com Utility + Pastebin.com Utility + Утилита для размещения кода на pastebin.com. + 4.0.4 + 08.02.2012 + alexzulu + Internet + 0 + + + paste + 2.0.0 + Sticky Notes Pastebin Utility + Sticky Notes Pastebin Utility + Утилита для размещения кода на сайтах построенных на Sticky Notes. + 4.0.2 + 25.01.2012 + alexzulu + Internet + 0 + + + hlog + 0.2.0 + Highlight log + Highlight log and viewer + Лог хайлайтов и просмотрщик для него. + 4.0.2 + 24.12.2014 + alexzulu + Tools + 0 + + + deadbeef_control + 1.0.3 + deadbeef player control + deadbeef player control. + Управление проигрывателем deadbeef. + 4.0.0 + 07.12.2012 + Prof. BiG BanG + Multimedia + 0 + + + slaps_l7508 + 0.0.1 + Slaps and greetings + Slaps and greetings. + Слапы и приветствия. + 4.0.0 + 13.10.2011 + unknown + Others + 0 + + + lag_control + 0.0.6 + Lag control + Automatically reconnect a client to a server with a long delay. + Пересоединение клиента с серверами с большим лагом. + 4.0.2 + 09.09.2011 + alexzulu + Tools + 0 + + + favorites + 1.0.2 + Favorites + Create a list of favorite channels and manage them. + Создание списка избранных каналов и управление им. + 4.0.2 + 17.03.2013 + alexzulu + Tools + 0 + + + chanstats + 2.0.0 + Channel Statistics + Shows Statistics for a joined channel. + Показывает статистику для канала. + 4.0.2 + 29.09.2016 + g00dsP33D + Tools + 0 + + + chanops + 1.0.0 + Channel Operations + Provides toolbar buttons for several commonly used channel operations. + Предоставляет кнопки на панели инструментов для нескольких часто используемых операций канала. + 4.0.2 + 05.10.2010 + Szymon Stefanek(Pragma) + Tools + 0 + + + twinsmediaplayer + 1.1.0 + The Twins Mediaplayer + An interface to the Mediaplayer module to play music and advertise it + Интерфейс к модулю Mediaplayer для воспроизведения музыки + 4.0.2 + 04.10.2010 + Ahinu + Multimedia + 0 + + + twininputcolor + 1.2.0 + The Twins Input Text Coloriser + Colorizes your text in channel, queries and DCC chats. + Раскрашивайте текст в каналах, приватах и DCC-чатах. + 4.0.2 + 04.10.2010 + Ahinu + Others + 0 + + + reverse2 + 2.6.4 + Reverse2 + Reverse2 - keyboards char-reverse + 4.0.2 + 04.10.2010 + runkoff + Tools + 0 + + + diksi_slaps + 1.0.0 + [Diksi] slaps + Menu with these funky slaps. You can scoff at the people on the channel. + Менюшка с такими прикольными слапами. Можно издеваться над народом на канале. + 4.0.2 + 04.10.2010 + [Diksi] + Others + 0 + + + amaranth + 1.6.1 + Amaranth + An interface to the Mediaplayer module + Интерфейс к модулю Mediaplayer для воспроизведения музыки + 4.0.2 + 04.10.2010 + Blaze + Multimedia + 1 + + + tools_panel + 0.0.1 + Tools buttons panel + A small panel with buttons frequently performed commands. + Небольшая панель с кнопками часто выполняемых команд + 4.0.0 + 16.11.2010 + alexzulu + Tools + 0 + + + debug_tools + 0.0.1 + Debug tools + Debug tools for KVS + Утилиты отладки для KVS + 4.2.0 + 02.03.2013 + alexzulu + Tools + 0 + + diff --git a/repository_updater/config/repository_updater_cfg.kvc b/repository_updater/config/repository_updater_cfg.kvc new file mode 100644 index 0000000..077d79c --- /dev/null +++ b/repository_updater/config/repository_updater_cfg.kvc @@ -0,0 +1,9 @@ +# KVIrc configuration file +[Main] +UrlList=http://kvirc.alexzulu.ru,http://kvirc-addons.buriedalive.ru +CurrentPeriod=60 +CurrentUrl=http://kvirc.alexzulu.ru +Cache=PLEASE, INPUT PATH FOR CACHE!!! +Version=4.0.0 +PeriodsList=15,30,60,90,120 +AutoUpdateList=0 diff --git a/repository_updater/init.kvs b/repository_updater/init.kvs new file mode 100755 index 0000000..5b008aa --- /dev/null +++ b/repository_updater/init.kvs @@ -0,0 +1 @@ +repository_updater::settings diff --git a/repository_updater/install.kvs b/repository_updater/install.kvs new file mode 100644 index 0000000..a7204c0 --- /dev/null +++ b/repository_updater/install.kvs @@ -0,0 +1,55 @@ +#Generate with Installer generator 0.0.1 (21:36:13 17.01.2017) + +# Written by alexzulu(2017) + +# register the script: this must be the first instruction executed +# since it will abort with an error when a greater version is already installed + +addon.register("repository_updater","0.0.1",$tr("Repository browser updater",repository_updater),$tr("Updater for repository browser",repository_updater),"4.2.0",repository_updater/updater32x32.png) +{ + # This is our uninstall callback: it will be called by KVIrc when addon.uninstall is invoked + # This is an automatically generated alias that will erase the installed files + + repository_updater::uninstallfiles +} + +# Ok, addon.register succeeded. We can go on with the installation. + +# Get the path that this script was launched from +%mypath = $file.extractPath($0) + +# get the installer helper class (this is pretty standard and included in the distro) +parse %mypath/utils/installer.kvs + +# The installer will copy our files and generate automatically +# an uninstallation alias for them +%installer = $new(installer,0,myinstaller) + +# Copy files in each subdirectory + +# the configs +if(!$file.exists($file.localdir("config/repository_updater"))) +{ + file.mkdir $file.localdir("config/repository_updater") +} +%installer->$copyFiles("%mypath/config/","*.*","$file.localdir("config/repository_updater")") + +# the pics +if(!$file.exists($file.localdir("pics/repository_updater"))) +{ + file.mkdir $file.localdir("pics/repository_updater") +} +%installer->$copyFiles("%mypath/pics/","*.png","$file.localdir("pics/repository_updater")") + +# parse source files +%installer->$includeFiles("%mypath/src/","*.kvs") + +# then generate the uninstall alias +%installer->$generateUninstallAlias("repository_updater::uninstallfiles") + +%installer->$includeFiles("%mypath/","init.kvs") + +# finally kill the installer helper +delete %installer + +# Done: the addon is installed and running: enjoy :) diff --git a/repository_updater/pics/updater32x32.png b/repository_updater/pics/updater32x32.png new file mode 100644 index 0000000..0b8a85d Binary files /dev/null and b/repository_updater/pics/updater32x32.png differ diff --git a/repository_updater/src/actions.kvs b/repository_updater/src/actions.kvs new file mode 100644 index 0000000..5a6979d --- /dev/null +++ b/repository_updater/src/actions.kvs @@ -0,0 +1,10 @@ +action.create -t=generic ("repository_browser_updater",$tr("Repository browser updater",repository_updater),$tr("Open repository browser updater",repository_updater),"repository_updater/updater32x32.png","") +{ + repository_updater::update +} + +action.create -t=tools ("repository_browser_updater_settings",$tr("Repository browser updater settings",repository_updater),$tr("Repository browser updater settings",repository_updater),"repository_updater/updater32x32.png","") +{ + repository_updater::settings +} + diff --git a/repository_updater/src/aliases.kvs b/repository_updater/src/aliases.kvs new file mode 100644 index 0000000..bb5cd89 --- /dev/null +++ b/repository_updater/src/aliases.kvs @@ -0,0 +1,68 @@ +alias(repository_updater::checker) +{ + %time = $0; + %sw = $1; + %time = $(%time * 60000); + //%time = $(%time * 1000); + if(%sw == 1){ + if($isTimer(updater)){ + killtimer updater; + timer(updater,%time){ + repository_updater::updateList + } + } else { + timer(updater,%time){ + repository_updater::updateList + } + } + } else { + if($isTimer(updater)){ + killtimer updater; + } + repository_updater::updateList(); + } +} + + +alias(repository_updater::init) +{ + %rep = "$file.localdir/config/repository_updater" + %cfg=$config.open(%rep/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + %period = $config.read(%cfg,CurrentPeriod) + %switch = $config.read(%cfg,AutoUpdateList) + config.close %cfg + $repository_updater::checker(%period,%switch) +} + + +alias(repository_updater::settings) +{ + %U_Set = $new(repository_updater::settings) +} + + +alias(repository_updater::update) +{ + %update = $new(repository_updater::update) +} + + +alias(repository_updater::updateList) +{ + %rep = "$file.localdir/config/repository_updater" + %cfg=$config.open(%rep/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + %currentUrl = $config.read(%cfg,CurrentUrl) + %ver = $config.read(%cfg,Version) + %n = $str.split(".",%ver) + %verM = %n[0] + config.close %cfg + http.asyncGet -y -с -e=o -w=h (%currentUrl/dists/%verM/rep_info.xml,%rep/rep_info.xml){ + // notifier.message -t=5 $tr("List updated",repository_browser) + %upd = $new(repository_updater::data); + } + // %upd = $new(repository_updater::data); +} + + diff --git a/repository_updater/src/classes.kvs b/repository_updater/src/classes.kvs new file mode 100644 index 0000000..f8453b9 --- /dev/null +++ b/repository_updater/src/classes.kvs @@ -0,0 +1,485 @@ +class("repository_updater::xmlparser","xmlreader") +{ + function parse() + { + if ($0 == ""){ + debug "[repository_browser::xmlparser] The name of the file to parse was not specified" + return $false + } + if (!$file.exists($0)){ + debug "[repository_browser::xmlparser] The file to parse was not found" + return $false + } + if(!$$->$xmlreader::parse($file.read($0))){ + debug "[repository_browser::xmlparser] Critical error: $$->$xmlreader::lastError()" + return $false; + }else{ + return @%stations + debug @%stations + } + } + + function onWarning() + { + warning $0 + return $true; + } + + function onText() + { + // debug $0 + %text = $0; + //Trim leading and trailing space characters + %text = $str.strip(%text) + if (%text) { + if (@%currentkey == n) { + %text =~ s/^\///g + } + // debug @%currentindex : \"%text\" + @%stations[@%currentindex]{@%currentkey} = %text + } + return $true; + } + + function onElementStart() + { + if ($0 == repository) return $true + if ($0 != addon) + { + @%currentkey = $0 + // debug @%currentkey + } + return $true; + } + + function onElementEnd() + { + //debug + if ($0 == addon) @%currentindex++ + return $true; + } + + function onDocumentStart() + { + @%stations = $array(); + @%currentindex = 0; + return $true; + } + + function onDocumentEnd() + { + return $true + } + +} + +class("repository_updater::update","object") +{ + function update() + { + %version = $0; + if($addon.exists(repository_browser)){ + %installed_version = $addon.version(repository_browser); + @$uninstall(); + @$install(%version); + }else{ + @$install(%version); + } + } + + function uninstall() + { + %cfg=$config.open($file.localdir/config/repository_updater/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + %cache = $config.read(%cfg,Cache) + config.close %cfg + + if($system.osname == "Linux"){ + %s_name = "repository_browser-$addon.version(repository_browser)" + %package = "%s_name.tar.gz" + if($file.exists(%cache/%s_name)){ + exec("rm -Rf %cache/%s_name"){}; + } + if($file.exists(%cache/%package)){ + exec("rm -Rf %cache/%package"){}; + } + if($addon.exists(repository_browser)){ + addon.uninstall repository_browser + } + } + + if($system.osname == "Windows"){ + %s_name = "repository_browser-$addon.version(repository_browser)" + %package = "%s_name.tar.gz" + if($addon.exists(repository_browser)){ + addon.uninstall repository_browser + } + if($file.exists(%cache/%s_name)){ + %txt <+ "cd %cache" + %txt <+ "rmdir /s /q %s_name" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q del.bat" + file.writeLines %cache/del.bat %txt + run %cache/del.bat; + } + if($file.exists(%cache/%package)){ + file.remove %cache/%package + } + } + } + + function search() + { + @%data = @$getData(); + if($addon.exists(repository_browser)){ + %rep_version = $addon.version(repository_browser); + } else { + %rep_version = "1.0.0"; + } + for (%i=0; %i<$length(@%data); %i++){ + if(@%data[%i]{name} == "repository_browser"){ + if($int($str.replace(%rep_version,".","")) < $int($str.replace(@%data[%i]{version},".",""))){ + %rep_version = @%data[%i]{version}; + } + } + } + if($int($str.replace(%rep_version,".","")) > $int($str.replace($addon.version(repository_browser),".",""))){ + @$update(%rep_version); + }else{ + notifier.message -i=318 -t=10 "You have a current version of the script."; + } + } + + function install() + { + %Rep = "$file.localdir/config/repository_updater" + %cfg=$config.open(%Rep/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + %CurrentUrl = $config.read(%cfg,CurrentUrl) + %Ver = $config.read(%cfg,Version) + %Cache = $config.read(%cfg,Cache) + %n = $str.split(".",%Ver) + %VerM = %n[0] + config.close %cfg + + %version = $0; + %S_name = "repository_browser-%version" + %Package = "%S_name.tar.gz" + if($system.osname == "Linux"){ + http.asyncGet -w=h -e=o (%CurrentUrl/pool/%VerM/%Package,%Cache/%Package){ + exec("tar zxvf %Cache/%Package -C %Cache"){}; + timer(iidl,3000){ + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + dialog.message($tr("Info",repository_updater),$tr("Addon installed",repository_updater),information,$tr("Close",repository_updater)){} + killtimer iidl + } + } + } + } + if($system.osname == "Windows"){ + %txt <+ "cd \"%Cache\"" + %txt <+ "\"%Rep/7za\" x -y %Package" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "\"%Rep/7za\" x -y *.tar" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q *.tar" + %txt <+ "ping 127.0.0.1 -n 5 > nul" + %txt <+ "del /q install.bat" + file.writeLines %Cache/install.bat %txt + + http.asyncGet -w=h -e=o (%CurrentUrl/pool/%VerM/%Package,%Cache/%Package){ + run %Cache/install.bat; + %N = 0 + timer (iidl,1000){ + %N = $(%N +1) + if($file.exists(%Cache/%S_name/install.kvs)){ + parse "%Cache/%S_name/install.kvs" + dialog.message($tr("Info",repository_updater),$tr("Addon installed",repository_updater),information,$tr("Ok",repository_updater)){} + killtimer iidl + } + if(%N == 20){ + dialog.message($tr("Warning",repository_updater),$tr("Addon not installed",repository_updater),warning,$tr("Ok",repository_updater)){} + killtimer iidl + } + } + } + } + } + + function getData() + { + %xml = $new(repository_updater::xmlparser); + if($file.exists("$file.localdir/config/repository_updater/rep_info.xml")){ + %addons = %xml->$parse("$file.localdir/config/repository_updater/rep_info.xml") + } + if (!%addons) { + debug "[repository_updater::xmlparser] Error while parsing xml-file $0" + return + } + return %addons; + } + + function constructor() + { + @$search(); + } + + function close() + { + unset %CurrentUrl,%Ver,%Cache,%VerM,%Rep,%S_name,%Package,%S_name,%Package + delete $$ + } + +} + +class("repository_updater::settings","dialog") +{ + function switch() + { + if(@%ckbAutoUpdateList->$isChecked()){ + @%cbAutoUpdateListPeriod->$setEnabled(1) + } else { + @%cbAutoUpdateListPeriod->$setEnabled(0) + } + } + + function selectDir() + { + dialog.file(dir,Choose addon folder,,"All files (*.*)") + { + if($0 == ""){ + dialog.message($tr("Warning",repository_updater),$tr("Path can not be empty!",repository_updater),warning,$tr("Close",repository_updater)){} + }else{ + %U_Set->%leCache->$setText($0) + } + } + } + + function save() + { + if($str.match("/*",@%leCache->$text())){ + %cfg=$config.open(%Rep/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + config.write %cfg UrlList %UrlList + config.write %cfg CurrentUrl @%cbUrl->$current(); + config.write %cfg CurrentPeriod @%cbAutoUpdateListPeriod->$current(); + config.write %cfg Version @%leVersion->$text(); + config.write %cfg Cache @%leCache->$text(); + config.write %cfg AutoUpdateList @%ckbAutoUpdateList->$isChecked(); + config.close %cfg + + repository_updater::init + @$close(); + }else{ + dialog.message($tr("Warning",repository_updater),$tr("Please select a folder!",repository_updater),warning,$tr("Close",repository_updater)){} + } + } + + function itemSelected() + { + // %CurrentUrl = @%cbUrl->$current() + } + + function getParams() + { + %Rep = "$file.localdir/config/repository_updater" + %cfg=$config.open(%Rep/repository_updater_cfg.kvc) + config.setsection %cfg "Main" + %CurrentUrl = $config.read(%cfg,CurrentUrl) + %UrlList = $config.read(%cfg,UrlList) + %PeriodsList = $config.read(%cfg,PeriodsList); + %CurrentPeriod = $config.read(%cfg,CurrentPeriod); + %Ver = $config.read(%cfg,Version) + %AutoUpdateList = $config.read(%cfg,AutoUpdateList) + %Cache = $config.read(%cfg,Cache) + %n = $str.split(".",%Ver) + %VerM = %n[0] + config.close %cfg + } + + function constructor() + { + @$getParams() + @%urllist = $str.split(",",%UrlList) + @%periodsList = $str.split(",",%PeriodsList) + + @$setWindowTitle($tr("Updater settings",repository_updater)) + @$setMinimumWidth(300) + @$setMaximumWidth(300) + @$setWFlags(Dialog) + @$centerToScreen() + + %l = $new(layout,$$); + %l->$setMargin(5) + %l->$setSpacing(0) + %l->$setColumnStretch(0,4) + %l->$setColumnStretch(1,1) + %l->$setColumnStretch(2,0) + + %l->$setRowStretch(0,1) + %l->$setRowStretch(1,1) + %l->$setRowStretch(2,1) + %l->$setRowStretch(3,2) + %l->$setRowStretch(4,2) + + %hb = $new(hbox,$$); + %hb->$setMargin(0) + %hb->$setSpacing(0) + %l->$addmulticellwidget(%hb,5,5,0,2) + + @%lbUrl = $new(label,$$) + @%lbUrl->$setMinimumHeight(30); + @%lbUrl->$setText($tr("URL repository",repository_updater)) + %l->$addwidget(@%lbUrl,0,0); + + @%cbUrl = $new(combobox,$$) + @%cbUrl->$setToolTip("Test tooltip"); + // @%cbUrl->$setEditable(true) + for(%i = 0;%i < $length(@%urllist);%i++){ + @%cbUrl->$insertItem("@%urllist[%i]") + if(@%urllist[%i] == %CurrentUrl){ + @%cbUrl->$setCurrentItem(%i) + } + } + %l->$addmulticellwidget(@%cbUrl,0,0,1,2); + + @%lbVersion = $new(label,$$) + @%lbVersion->$setMinimumHeight(30); + @%lbVersion->$setText($tr("Version KVIrc",repository_updater)) + %l->$addwidget(@%lbVersion,1,0); + + @%leVersion = $new(lineedit,$$) + @%leVersion->$setText("%Ver") + %l->$addmulticellwidget(@%leVersion,1,1,1,2); + + @%lbCache = $new(label,$$) + @%lbCache->$setMinimumHeight(30); + @%lbCache->$setText($tr("Local cache",repository_updater)) + %l->$addwidget(@%lbCache,2,0); + + @%leCache = $new(lineedit,$$) + @%leCache->$setText("%Cache") + %l->$addwidget(@%leCache,2,1); + + @%btCacheDir = $new(button,$$) + @%btCacheDir->$setImage(106) + %l->$addwidget(@%btCacheDir,2,2); + + @%lbAutoUpdateList = $new(label,$$) + @%lbAutoUpdateList->$setMinimumHeight(30); + @%lbAutoUpdateList->$setText($tr("Autoupdate list",repository_updater)) + %l->$addwidget(@%lbAutoUpdateList,3,0); + + @%ckbAutoUpdateList = $new(checkbox,$$); + if(%AutoUpdateList == 1){ + @%ckbAutoUpdateList->$setChecked(1); + } + %l->$addwidget(@%ckbAutoUpdateList,3,2); + + @%lbAutoUpdateListPeriod = $new(label,$$) + @%lbAutoUpdateListPeriod->$setMinimumHeight(30); + @%lbAutoUpdateListPeriod->$setText($tr("Autoupdate time",repository_updater)) + %l->$addwidget(@%lbAutoUpdateListPeriod,4,0); + + @%cbAutoUpdateListPeriod = $new(combobox,$$) + for(%i = 0;%i < $length(@%periodsList);%i++){ + @%cbAutoUpdateListPeriod->$insertItem("@%periodsList[%i]"); + if(@%periodsList[%i] == %CurrentPeriod){ + @%cbAutoUpdateListPeriod->$setCurrentItem(%i) + } + } + if(@%ckbAutoUpdateList->$isChecked()){ + @%cbAutoUpdateListPeriod->$setEnabled(1) + } else { + @%cbAutoUpdateListPeriod->$setEnabled(0) + } + %l->$addMultiCellWidget(@%cbAutoUpdateListPeriod,4,4,1,2); + objects.connect @%ckbAutoUpdateList "toggled" $$ switch + + @%btSave = $new(button, %hb) + @%btSave->$setText($tr("Save",repository_updater)) + + + @%btCancel = $new(button, %hb) + @%btCancel->$setText($tr("Cancel",repository_updater)) + + objects.connect @%btCacheDir "clicked" $$ selectDir + objects.connect @%btSave "clicked" $$ save + objects.connect @%btCancel "clicked" $$ close + + @$show() + } + + function closeEvent() + { + unset %U_Set,%CurrentUrl,%UrlList,%Ver,%Cache,%VerM,%Rep,%S_name,%Package,%AutoUpdateList,%PeriodsList,%CurrentPeriod + } + + function close() + { + if($str.match("/*",@%leCache->$text())) { + delete $$ + unset %U_Set,%CurrentUrl,%UrlList,%Ver,%Cache,%VerM,%Rep,%S_name,%Package,%AutoUpdateList,%PeriodsList,%CurrentPeriod + } else { + dialog.message($tr("Warning",repository_updater),$tr("Please select a folder!",repository_updater),warning,$tr("Close",repository_updater)){} + } + } + +} + +class("repository_updater::data","object") +{ + function search() + { + @%data = @$getData(); + if($addon.exists(repository_browser)){ + %rep_version = $addon.version(repository_browser); + } else { + %rep_version = "1.0.0"; + } + for (%i=0; %i<$length(@%data); %i++){ + if(@%data[%i]{name} == "repository_browser"){ + if($int($str.replace(%rep_version,".","")) < $int($str.replace(@%data[%i]{version},".",""))){ + %rep_version = @%data[%i]{version}; + } + } + } + // debug installed $addon.version(repository_browser) + // debug in rep %rep_version; + if($int($str.replace(%rep_version,".","")) > $int($str.replace($addon.version(repository_browser),".",""))){ + notifier.message -i=318 -t=10 "Repository browser need update!" + if(%updater_snd == "1"){ + snd.play $file.homedir/r2d2.wav + } + }else{ + notifier.message -i=318 -t=10 "You have a current version of the script."; + } + @$close(); + } + + function getData() + { + %xml = $new(repository_updater::xmlparser); + if($file.exists("$file.localdir/config/repository_updater/rep_info.xml")){ + %addons = %xml->$parse("$file.localdir/config/repository_updater/rep_info.xml") + } + if (!%addons){ + debug "[repository_updater::xmlparser] Error while parsing xml-file $0" + return + } + return %addons; + } + + function constructor() + { + @$search(); + } + + function close() + { + delete $$ + } + +} + diff --git a/repository_updater/src/events.kvs b/repository_updater/src/events.kvs new file mode 100644 index 0000000..5b5c2ce --- /dev/null +++ b/repository_updater/src/events.kvs @@ -0,0 +1,5 @@ +event(OnKVIrcStartup,repository_updater) +{ + repository_updater::init +} + diff --git a/repository_updater/src/toolbars.kvs b/repository_updater/src/toolbars.kvs new file mode 100755 index 0000000..829d517 --- /dev/null +++ b/repository_updater/src/toolbars.kvs @@ -0,0 +1,3 @@ +toolbar.create repository_updater Repository browser updater "repository_updater/updater32x32.png" +toolbar.additem repository_updater repository_browser_updater +toolbar.show repository_updater diff --git a/repository_updater/utils/installer.kvs b/repository_updater/utils/installer.kvs new file mode 100644 index 0000000..62cd0e1 --- /dev/null +++ b/repository_updater/utils/installer.kvs @@ -0,0 +1,184 @@ +/* + A helper class for installing and parsing files, + and generating an uninstallation alias on the fly. + + Example : + include "utils/installer.kvs" + %installer = $new(installer,0,myinstaller) + %installer->$copyFiles(pics,*.png,$file.localdir(pics)) + %installer->$includeFiles(src,*.kvs) + %installer->generateUninstallAlias("foo::uninstall") + delete %installer + Here, "foo::uninstall" must be called in you uninstall + callback script. + + Warnings: + 1) Declaration of aliases, popups, etc, in source files + (.kvs) must be in a similar format + as when you export them directly from kvirc. + Example: + alias(myalias) + defpopup(mypopup) + 2) If you use a "defpopup -m" to add an item to an + existing popup,this item won't be registered + automatically for uninstallation by this installer script. + You should typically identify the item you added using + the "id" parameter. See this example where the id is + "myaddon::myitem": + defpopup -m (channeltextview) + { + item(MyItem)(myaddon::myitem) + { + ... + } + } + Then, you add this line to you uninstall callback + script: + delpopupitem channeltextview myaddon::myitem +*/ +class(installer,object) +{ + constructor() + { + } + + copyFiles($0 = source dir,$1 = file regexp,$2 = target dir) + { + if(!$file.exists($0))return + if($isempty($0)) + { + echo $tr("[Installer] The first argument to \%installer->\$copyfiles must be a source directory") + halt + } + + if($isempty($1)) + { + echo $tr("[Installer] The second argument to \%installer->\$copyfiles must be a file name or file regexp") + halt + } + + if($isempty($2)) + { + echo $tr("[Installer] The third argument to \%installer->\$copyfiles must be a destination directory") + halt + } + + if($file.exists($0)) + { + %files = $file.ls($file.fixpath($0),f,$1) + if($length(%files)) + { + @$mkdir($2) + foreach(%file,%files) + { + $this->%lFiles <+ $str.replace($file.fixpath("$2/%file"),"\\\\","\\") + file.copy -o $file.fixpath($0/%file) $file.fixpath($2/%file) + } + } + } + } + + // Recursive creation of directory + mkdir($0 = directory) + { + if($isempty($0) || $file.exists($0)) return + foreach -a (%subdir,$str.split("/",$file.fixpath($0))) + { + %p <+ %subdir + %path = $str.join("/",%p) + if(!$file.exists(%path)) + file.mkdir -q %path + } + if(!$file.exists($0)) + { + echo $tr("[Installer] Failed to create directory") \"$0\" + return + } + } + + // Parse source files and get what will need to be uninstalled + includeFiles($0 = dir, $1 = file regexp) + { + if($isempty($0)) + { + echo $tr("[Installer] The first argument to \%installer->\$includefiles must be a source directory") + halt + } + + @$mkdir($0) + + if($1 == "") + %szRe = "*.kvs" + else + %szRe = $1 + + %files = $file.ls($file.extractpath($0),f,$1) + if($length(%files)) + { + foreach(%file,%files) + { + $this->%lSources <+ $str.replace($file.fixpath("$0/%file"),"\\\\","\\") + include $file.fixpath("$0/%file") + } + } + } + + + generateUninstallAlias($0 = alias name) + { + %c = "alias($0)$lf" + %c .= "{$lf" + if($isset($this->%lFiles)) + { + %d = "" + foreach(%file,$this->%lFiles) + { +// %file =~ s/"^$file.localdir()/(.*)$"/"\$file.localdir(\\1)"/ + %file = $str.replace(%file,"\\","/") + %c .= "file.remove -q \"%file\"$lf"; + if(%d != $file.extractpath(%file)) + { + %d = $file.extractpath(%file) + %u .= "file.rmdir -q \"%d\"$lf"; + } + } + %c .= %u + } + + if($isset($this->%lSources)) + { + foreach(%file,$this->%lSources){ + foreach(%line,$file.readlines(%file)) + if(!$str.isempty(%line)){ + if($str.match("*extpopup(*)",%line,e)){ + %s = $str.split(",",%line) + %s = $str.split(")",%s[$($length(%s) - 1)]) + %s = $str.split(".",%s[0]) + %c .= "delpopupitem -d "%s[0] %s[0].%s[1]"$lf" + } + if($str.match("event(*)*",%line,e)) + %c .= "eventctl -u "$str.token(1,"(,)",%line) $str.token(2,"(,)",%line)"$lf" + else if($str.match("alias(*)",%line,e)) + %aliases<+$str.token(1,"()",%line) + else if($str.match("defpopup(*)",%line,e)) + %c .= "defpopup("$str.token(1,"()",%line)"){}$lf" + else if($str.match("toolbar.create * *",%line,e)) + %c .= "toolbar.destroy -q "$str.word(1,%line)"$lf" + else if($str.match("action.create* (*)",%line,e)) + %c .= "action.destroy -q "$str.replace($str.token(1,"(,)",%line),\","")"$lf" + else if($str.match("class(*)*",%line,e)) + %c .= "objects.killclass -q "$str.token(1,"(,)",%line)"$lf" + } + } + if($isset(%aliases)) + foreach(%alias,%aliases) + %c .= "alias -q (%alias){}$lf" + %c .= "alias -q ($0){}$lf" + } + %c .= "}" + eval %c + } +} + + +