From c081248a92bb7c1eb2681156e829affd28fa8080 Mon Sep 17 00:00:00 2001 From: pescuma Date: Mon, 4 Jan 2010 17:49:05 +0000 Subject: iax: 0.1.1.0 git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@204 c086bb3d-8645-0410-b8da-73a8550f86e7 --- Protocols/IAX/Docs/iax_changelog.txt | 4 + Protocols/IAX/Docs/iax_readme.txt | 2 - Protocols/IAX/Docs/iax_version.txt | 2 +- Protocols/IAX/IAXProto.cpp | 8 +- Protocols/IAX/IAXProto.h | 8 +- Protocols/IAX/build/doit.bat | 112 ------------ Protocols/IAX/build/google_code.rb | 191 ++++++++++++++++++++ Protocols/IAX/build/rakefile | 332 +++++++++++++++++++++++++++++++++++ Protocols/IAX/build/zip.exe | Bin 0 -> 290816 bytes Protocols/IAX/iax.cpp | 2 +- 10 files changed, 537 insertions(+), 124 deletions(-) delete mode 100644 Protocols/IAX/build/doit.bat create mode 100644 Protocols/IAX/build/google_code.rb create mode 100644 Protocols/IAX/build/rakefile create mode 100644 Protocols/IAX/build/zip.exe diff --git a/Protocols/IAX/Docs/iax_changelog.txt b/Protocols/IAX/Docs/iax_changelog.txt index 2122737..338da46 100644 --- a/Protocols/IAX/Docs/iax_changelog.txt +++ b/Protocols/IAX/Docs/iax_changelog.txt @@ -2,5 +2,9 @@ IAX protocol Changelog: +. 0.1.1.0 + * Small fixes + * Compatibility with new voice service + . 0.1.0.0 + Initial version \ No newline at end of file diff --git a/Protocols/IAX/Docs/iax_readme.txt b/Protocols/IAX/Docs/iax_readme.txt index 79c60a8..e8987d7 100644 --- a/Protocols/IAX/Docs/iax_readme.txt +++ b/Protocols/IAX/Docs/iax_readme.txt @@ -19,6 +19,4 @@ Todo: - Ask for new password at first login if "Save password" is not checked -The first versions will be compiled as debug and contain the dependency plugin to help setup. Before releasing in FL I'll change that. - To report bugs/make suggestions, go to the forum thread: http://forums.miranda-im.org/showthread.php?p=195413 \ No newline at end of file diff --git a/Protocols/IAX/Docs/iax_version.txt b/Protocols/IAX/Docs/iax_version.txt index 1628d11..1d74099 100644 --- a/Protocols/IAX/Docs/iax_version.txt +++ b/Protocols/IAX/Docs/iax_version.txt @@ -1 +1 @@ -IAX protocol 0.1.0.0 \ No newline at end of file +IAX protocol 0.1.1.0 \ No newline at end of file diff --git a/Protocols/IAX/IAXProto.cpp b/Protocols/IAX/IAXProto.cpp index d8108e2..b1f81de 100644 --- a/Protocols/IAX/IAXProto.cpp +++ b/Protocols/IAX/IAXProto.cpp @@ -241,7 +241,7 @@ int IAXProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProce #define MESSAGE_TYPE_ERROR 2 -void IAXProto::Trace(TCHAR *fmt, ...) +void IAXProto::Trace(const TCHAR *fmt, ...) { va_list args; va_start(args, fmt); @@ -252,7 +252,7 @@ void IAXProto::Trace(TCHAR *fmt, ...) } -void IAXProto::Info(TCHAR *fmt, ...) +void IAXProto::Info(const TCHAR *fmt, ...) { va_list args; va_start(args, fmt); @@ -263,7 +263,7 @@ void IAXProto::Info(TCHAR *fmt, ...) } -void IAXProto::Error(TCHAR *fmt, ...) +void IAXProto::Error(const TCHAR *fmt, ...) { va_list args; va_start(args, fmt); @@ -274,7 +274,7 @@ void IAXProto::Error(TCHAR *fmt, ...) } -void IAXProto::ShowMessage(int type, TCHAR *fmt, va_list args) +void IAXProto::ShowMessage(int type, const TCHAR *fmt, va_list args) { TCHAR buff[1024]; if (type == MESSAGE_TYPE_TRACE) diff --git a/Protocols/IAX/IAXProto.h b/Protocols/IAX/IAXProto.h index 5a9a1f3..584342b 100644 --- a/Protocols/IAX/IAXProto.h +++ b/Protocols/IAX/IAXProto.h @@ -119,10 +119,10 @@ private: INT_PTR __cdecl OnOptionsInit(WPARAM wParam,LPARAM lParam); INT_PTR __cdecl OnPreShutdown(WPARAM wParam,LPARAM lParam); - void Trace(TCHAR *fmt, ...); - void Info(TCHAR *fmt, ...); - void Error(TCHAR *fmt, ...); - void ShowMessage(int type, TCHAR *fmt, va_list args); + void Trace(const TCHAR *fmt, ...); + void Info(const TCHAR *fmt, ...); + void Error(const TCHAR *fmt, ...); + void ShowMessage(int type, const TCHAR *fmt, va_list args); void Disconnect(); INT_PTR __cdecl CreateAccMgrUI(WPARAM wParam, LPARAM lParam); diff --git a/Protocols/IAX/build/doit.bat b/Protocols/IAX/build/doit.bat deleted file mode 100644 index d4226ad..0000000 --- a/Protocols/IAX/build/doit.bat +++ /dev/null @@ -1,112 +0,0 @@ -@echo off - -rem Batch file to build and upload files -rem -rem TODO: Integration with FL - -set name=iax - -rem To upload, this var must be set here or in other batch -rem set ftp=ftp://:@/ - -echo Building %name% ... - -msdev ..\%name%.dsp /MAKE "%name% - Win32 Release" /REBUILD -msdev ..\%name%.dsp /MAKE "%name% - Win32 Unicode Release" /REBUILD - -echo Generating files for %name% ... - -del *.zip -del *.dll -del *.pdb -rd /S /Q Plugins -rd /S /Q Docs -rd /S /Q src - -copy ..\Release\%name%.pdb -copy ..\Unicode_Release\%name%W.pdb -copy ..\Docs\%name%_changelog.txt -copy ..\Docs\%name%_version.txt -copy ..\Docs\%name%_readme.txt -mkdir Docs -cd Docs -del /Q *.* -copy ..\..\Docs\*.* -del %name%_version.txt -cd .. -mkdir src -cd src -mkdir %name% -cd %name% -del /Q *.* -copy ..\..\..\*.h -copy ..\..\..\*.cpp -copy ..\..\..\*.rc -copy ..\..\..\*.dsp -copy ..\..\..\*.dsw -mkdir res -cd res -del /Q *.* -copy ..\..\..\..\res\*.* -cd .. -mkdir sdk -cd sdk -del /Q *.* -copy ..\..\..\..\sdk\*.* -cd .. -mkdir Docs -cd Docs -del /Q *.* -copy ..\..\..\..\Docs\*.* -cd .. -cd .. -mkdir utils -cd utils -del /Q *.* -copy ..\..\..\..\..\plugins\utils\*.* -cd .. -cd .. - -mkdir Plugins -cd Plugins -del /Q *.dll -copy ..\..\..\..\bin\release\Plugins\%name%.dll -cd .. - -"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%.zip Plugins Docs - -cd Plugins -del /Q *.dll -copy "..\..\..\..\bin\Release Unicode\Plugins\%name%W.dll" -cd .. - -"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%W.zip Plugins Docs - -"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%.pdb.zip %name%.pdb -"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%W.pdb.zip %name%W.pdb - -"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%_src.zip src\*.* - -del *.dll -del *.PDB - -rd /S /Q Plugins -rd /S /Q Docs -rd /S /Q src - -if "%ftp%"=="" GOTO END - -echo Going to upload files... -pause - -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%.zip %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%W.zip %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%.pdb.zip %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%W.pdb.zip %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_changelog.txt %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_version.txt %ftp% -overwrite -close -"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_readme.txt %ftp% -overwrite -close - -:END - -echo Done. diff --git a/Protocols/IAX/build/google_code.rb b/Protocols/IAX/build/google_code.rb new file mode 100644 index 0000000..1c44900 --- /dev/null +++ b/Protocols/IAX/build/google_code.rb @@ -0,0 +1,191 @@ +require 'mechanize' + +class GoogleCode + FEATURED = "Featured" + DEPRECATED = "Deprecated" + + def initialize(project, username, password) + @browser = WWW::Mechanize.new + @project = project + + page = @browser.get(build_url) + + page = @browser.click page.link_with(:text => 'Sign in') + + form = page.forms.find_all { |form| \ + form.action == 'https://www.google.com/accounts/ServiceLoginAuth?service=code' \ + && form.has_field?("Email") \ + && form.has_field?("Passwd") }[0] + + raise "Could not talk to googlecode. Have they changed the pages layout?" unless form + + form.Email = username + form.Passwd = password + + page = form.submit + + raise 'GoogleCode: Invalid username/password' unless page.forms.length == 0 + end + + def all_files + get_files("downloads/list?can=1") + end + + def current_files + get_files("downloads/list?can=2") + end + + def featured_files + get_files("downloads/list?can=3") + end + + def deprecated_files + get_files("downloads/list?can=4") + end + + def fetch(filename) + page = @browser.get(build_url("downloads/detail?name=#{filename}")) + + form = page.form_with(:action => "update.do?name=#{filename}") + raise "Could not talk to googlecode. Have they changed the pages layout?" unless form + + file = Download.new filename + file.description = form.summary + file.labels = [] + form.fields.each { |f| file.labels << f.value if f.name == 'label' && f.value.length > 0 } + + file + end + + def update(file) + page = @browser.get(build_url("downloads/detail?name=#{file.filename}")) + + form = page.form_with(:action => "update.do?name=#{file.filename}") + raise "Could not talk to googlecode. Have they changed the pages layout?" unless form + + form.summary = file.description + + pos = 0 + form.fields.each do |f| + if f.name == 'label' + f.value = file.labels[pos] || '' + pos = pos + 1 + end + end + + form.submit # TODO Validate result + end + + def upload(file) + raise 'filename can\'t be empty' unless (file.filename || '').strip.length > 0 + raise 'description can\'t be empty' unless (file.description || '').strip.length > 0 + raise 'local_file can\'t be empty' unless (file.local_file || '').strip.length > 0 + + local_file = File.expand_path(file.local_file) + raise 'Local file could not be read' unless File.exist?(local_file) + raise 'Filename should be equal to local filename' unless File.basename(local_file) == file.filename + + page = @browser.get(build_url('downloads/entry')) + + form = page.form_with(:action => "http://uploads.code.google.com/upload/#{@project}") + raise "Could not talk to googlecode. Have they changed the pages layout?" unless form + + form.summary = file.description.strip + + pos = 0 + form.fields.each do |f| + if f.name == 'label' + f.value = (file.labels[pos] || '').strip + pos = pos + 1 + end + end + + form.file_uploads.first.file_name = local_file + + page = form.submit + + form = page.form_with(:action => "http://uploads.code.google.com/upload/#{@project}") + raise "Error uploading file #{file}" if form + + end + + class Download + attr_accessor :description, :labels, :local_file + attr_reader :filename + + def initialize(filename, fetcher = nil) + @filename = filename.strip + raise 'filename can\'t be empty' unless @filename + + @description = '' + @labels = [] + @fetcher = fetcher + end + + def description + fetch + return @description + end + + def labels + fetch + return @labels + end + + def to_s + fetch + ret = @filename + ret += ' : ' + @description if @description + ret += ' [' + @labels.join(', ') + ']' if @labels.length > 0 + end + + def <=>(other) + return @filename.casecmp(other.filename) + end + + private + + def fetch + return unless @fetcher + + tmp = @fetcher.fetch @filename + + @description = tmp.description + @labels = tmp.labels + + @fetcher = nil + end + + end + + + private + + def build_url(suffix = '') + if suffix == '' + return "http://code.google.com/p/#{@project}" + elsif suffix[0] == '/' + "http://code.google.com/p/#{@project}#{suffix}" + else + "http://code.google.com/p/#{@project}/#{suffix}" + end + end + + def get_files(url) + page = @browser.get(build_url(url)) + + start = "http://#{@project}.googlecode.com/files/" + + ret = [] + page.links.each do |link| + id = link.href + if id.length > start.length && id.slice(0, start.length) == start + id = id.slice(start.length, id.length - start.length) + ret << Download.new(id, self) + end + end + + return ret + end + +end diff --git a/Protocols/IAX/build/rakefile b/Protocols/IAX/build/rakefile new file mode 100644 index 0000000..6fa6b8d --- /dev/null +++ b/Protocols/IAX/build/rakefile @@ -0,0 +1,332 @@ +require 'rake' +require 'fileutils' +require 'rake/clean' +require 'google_code' +require 'net/ftp' + +RakeFileUtils.verbose(false) + +PROJECT="iax" +GC_NAME = "IAX" + +SRC_DIR=File.expand_path("..") +DOCS_DIR=File.expand_path("../Docs") +VERSION_FILE="#{DOCS_DIR}/#{PROJECT}_version.txt" + +TYPES=[ 'ansi', 'unicode' ] + +version=nil + +def cp_relative(file, base, target) + file = File.expand_path(file) + base = File.expand_path(base) + raise "Wrong file/base : #{file} / #base" unless file.slice(0, base.length) == base + + relative = file.slice(base.length, file.length - base.length) + target = File.expand_path(File.join(target, relative)) + target_dir = File.dirname(target) + + makedirs target_dir unless File.exists?(target_dir) + cp file, target +end + + +task :get_version do + File.open(VERSION_FILE, "r") do |file| + while (line = file.gets) + version = (line.match(/\d+\.\d+\.\d+\.\d+/) || [])[0] + break if version + end + end + raise "Could not read version file" unless VERSION + puts + puts "Current #{PROJECT} version: #{version}" +end + + +# Build ############################################################################## + +SOLUTION="#{PROJECT}.dsw" +CONFIG=[ "Release", "Unicode Release" ] +BUILD_RESULT_DIR=[ "../Release", "../Unicode_Release" ] +DLL=[ "../../../bin/Release/Plugins/#{PROJECT}.dll", "../../../bin/Release Unicode/Plugins/#{PROJECT}W.dll" ] +PDB=[ "#{BUILD_RESULT_DIR[0]}/#{PROJECT}.pdb", "#{BUILD_RESULT_DIR[1]}/#{PROJECT}W.pdb" ] + +(0..1).each do |i| + type = TYPES[i] + + build = "build_#{type}".to_s + + desc "Build #{type} project" + task build do + puts + puts "Building #{type} #{PROJECT}" + chdir(SRC_DIR) do + sh "msdev #{SOLUTION} /MAKE \"#{PROJECT} - Win32 #{CONFIG[i]}\" /REBUILD" do |ok, status| + ok or fail "Failed to compile #{type} dll (#{status.exitstatus})" + end + end + end + task :build => build + + CLEAN.include(File.join(BUILD_RESULT_DIR[i], '/**/*')) + CLOBBER.include(DLL[i]) +end + + +# Source zip ######################################################################### + +SRC_FILES = FileList[ \ + "#{SRC_DIR}/*.cpp", \ + "#{SRC_DIR}/*.h", \ + "#{SRC_DIR}/*.rc", \ + "#{SRC_DIR}/*.dsp", \ + "#{SRC_DIR}/*.dsw", \ + "#{SRC_DIR}/lib/**/*.h", \ + "#{SRC_DIR}/sdk/**/*.h" \ +] +SRC_ZIP="#{PROJECT}_src" +SRC_ZIP_FOLDER='zip_src' + +task :clean_package_src do + rmtree SRC_ZIP_FOLDER +end +task :clean => :clean_package_src + +desc "Create source package" +task :package_src => :get_version do + + zip = "#{SRC_ZIP}.#{version}.zip" + puts + puts "Packaging #{zip}" + + rmtree SRC_ZIP_FOLDER + mkdir SRC_ZIP_FOLDER + + SRC_FILES.each do |file| + cp_relative(file, SRC_DIR, SRC_ZIP_FOLDER) + end + + rm zip, :force => true + chdir(SRC_ZIP_FOLDER) do + sh "../zip -r -q ../#{zip} *" + end + + rmtree SRC_ZIP_FOLDER +end +task :package => :package_src + +CLOBBER.include("#{SRC_ZIP}.*.zip") + + + +# Dll zips ########################################################################### + +ZIP_FOLDERS=['zip_ansi', 'zip_unicode'] +ZIPS=[ "#{PROJECT}", "#{PROJECT}W" ] + +VOICE_SERVICE=[ "../../../bin/Release/Plugins/voiceservice.dll", "../../../bin/Release/Plugins/voiceserviceW.dll" ] + +(0..1).each do |i| + type = TYPES[i] + + clean = "clean_package_#{type}".to_s + package = "package_#{type}".to_s + + task clean do + rmtree ZIP_FOLDERS[i] + rmtree ZIP_FOLDERS[i] + '_pdb' + end + task :clean => clean + + desc "Create #{type} package" + task package => [ :get_version, "build_#{type}".to_s ] do + zip = "#{ZIPS[i]}.#{version}.zip" + puts + puts "Packaging #{zip}" + + rmtree ZIP_FOLDERS[i] + mkdir ZIP_FOLDERS[i] + + target_dir = File.join(ZIP_FOLDERS[i], 'Docs') + docs = FileList["#{DOCS_DIR}/*"] + docs.exclude(VERSION_FILE) + docs.each do |file| + cp_relative(file, DOCS_DIR, target_dir) + end + + target_dir = File.join(ZIP_FOLDERS[i], 'Plugins') + makedirs target_dir + cp DLL[i], target_dir + cp VOICE_SERVICE[i], target_dir + + rm zip, :force => true + chdir(ZIP_FOLDERS[i]) do + sh "../zip -r -q ../#{zip} *" + end + rmtree ZIP_FOLDERS[i] + + zip = "#{ZIPS[i]}.pdb.#{version}.zip" + puts + puts "Packaging #{zip}" + + rmtree ZIP_FOLDERS[i] + '_pdb' + target_dir = ZIP_FOLDERS[i] + '_pdb/Plugins' + makedirs target_dir + cp PDB[i], target_dir + chdir(ZIP_FOLDERS[i] + '_pdb') do + sh "../zip -r -q ../#{zip} *" + end + rmtree ZIP_FOLDERS[i] + '_pdb' + end + task :package => package + + CLOBBER.include("#{ZIPS[i]}.pdb.*.zip") + CLOBBER.include("#{ZIPS[i]}.*.zip") +end + + +# Rebuild ############################################################################ + +desc "Rebuild all #{PROJECT} versions" +task :rebuild => [ :clobber, :build ] + +desc "Build all #{PROJECT} versions" +task :build + + +# Upload ############################################################################# + +desc "Build and upload files" +task :upload + + +def empty?(str) + return true unless str + return str.strip.length <= 0 +end + +def ask(name, val=nil) + if empty?(val) + puts + print "#{name}: " + return STDIN.gets.chomp + else + return val + end +end + +desc "Upload to googlecode" +task :upload_googlecode => [ :package, :get_version ] do + files = [ "#{ZIPS[0]}.#{version}.zip", \ + "#{ZIPS[0]}.pdb.#{version}.zip", \ + "#{ZIPS[1]}.#{version}.zip", \ + "#{ZIPS[1]}.pdb.#{version}.zip" \ + ] + descriptions = [ "#{GC_NAME} #{version} - Ansi", \ + "#{GC_NAME} PDB #{version} - Ansi", \ + "#{GC_NAME} #{version} - Unicode", \ + "#{GC_NAME} PDB #{version} - Unicode" \ + ] + type = [ "Ansi", "Ansi", "Unicode", "Unicode" ] + + files.each do |file| + raise "Google Code: File not found: #{file}" unless File.exists?(file) + end + + project = nil + username = nil + password = nil + + if File.exists?("googlecode.passwd") + File.open("googlecode.passwd", "r") do |file| + line = file.gets + project,username,password = line.split(':') + end + end + + project = ask("Google Code Project", project) + username = ask("Google Code Username", username) + password = ask("Google Code Password", password) + + raise "Google Code: Invalid data" if empty?(project) || empty?(username) || empty?(password) + + gc = GoogleCode.new(project, username, password) + + gc.current_files.each do |file| + if file.description.slice(0, GC_NAME.length + 1) == GC_NAME + ' ' + file.labels.reject! { |label| label == GoogleCode::FEATURED } + file.labels << GoogleCode::DEPRECATED + gc.update(file) + end + end + + puts + (0...files.length).each do |i| + puts "Google Code: uploading #{files[i]}" + + file = GoogleCode::Download.new File.basename(files[i]) + file.description = descriptions[i] + file.labels << GoogleCode::FEATURED unless descriptions[i].match('PDB') + file.labels << 'Type-' + type[i] << 'Plugin-' + GC_NAME + file.local_file = files[i] + + gc.upload(file) + end + +end +task :upload => :upload_googlecode + + +desc "Upload to ftp" +task :upload_ftp => [ :package, :get_version ] do + files = [ "#{ZIPS[0]}.#{version}.zip", \ + "#{ZIPS[0]}.pdb.#{version}.zip", \ + "#{ZIPS[1]}.#{version}.zip", \ + "#{ZIPS[1]}.pdb.#{version}.zip", \ + "#{SRC_ZIP}.#{version}.zip", \ + "#{DOCS_DIR}/#{PROJECT}_changelog.txt", \ + "#{DOCS_DIR}/#{PROJECT}_readme.txt", \ + "#{DOCS_DIR}/#{PROJECT}_version.txt" \ + ] + + files.each do |file| + raise "FTP: File not found: #{file}" unless File.exists?(file) + end + + server = nil + path = nil + username = nil + password = nil + + if File.exists?("ftp.passwd") + File.open("ftp.passwd", "r") do |file| + line = file.gets + server,path,username,password = line.split(':') + end + end + + server = ask("FTP Server", server) + path = ask("FTP path", path) + username = ask("FTP Username", username) + password = ask("FTP Password", password) + + raise "FTP: Invalid data" if empty?(server) || empty?(path) || empty?(username) || empty?(password) + + puts + Net::FTP.open(server, username, password) do |ftp| + files.each do |file| + puts "FTP: Uploading #{File.basename(file)}" + + remote = File.join(path, File.basename(file).gsub(/\.\d+\.\d+\.\d+\.\d+/, '')) + + begin + ftp.delete remote + rescue + end + + ftp.putbinaryfile(file, remote) + end + end +end +task :upload => :upload_ftp \ No newline at end of file diff --git a/Protocols/IAX/build/zip.exe b/Protocols/IAX/build/zip.exe new file mode 100644 index 0000000..65de183 Binary files /dev/null and b/Protocols/IAX/build/zip.exe differ diff --git a/Protocols/IAX/iax.cpp b/Protocols/IAX/iax.cpp index 4fbf873..7c5ceb4 100644 --- a/Protocols/IAX/iax.cpp +++ b/Protocols/IAX/iax.cpp @@ -30,7 +30,7 @@ PLUGININFOEX pluginInfo={ #else "IAX protocol (Ansi)", #endif - PLUGIN_MAKE_VERSION(0,1,0,0), + PLUGIN_MAKE_VERSION(0,1,1,0), "Provides support for Inter-Asterisk eXchange (IAX) protocol", "Ricardo Pescuma Domenecci", "pescuma@miranda-im.org", -- cgit v1.2.3