Nice! I'll add support for Adium's .AdiumEmoticonset bundle later on today.
- Tom kakar...@users.sourceforge.net wrote: > Revision: 11001 > http://amsn.svn.sourceforge.net/amsn/?rev=11001&view=rev > Author: kakaroto > Date: 2009-02-17 04:10:21 +0000 (Tue, 17 Feb 2009) > > Log Message: > ----------- > Adding skeleton code for an emoticon_importer.. no GUI but the > AddNewCustomEmoticon function in there works just as expected! > now just someone add the UI for it! > > Added Paths: > ----------- > trunk/amsn-extras/plugins/emoticon_importer/ > trunk/amsn-extras/plugins/emoticon_importer/emoticon_importer.tcl > trunk/amsn-extras/plugins/emoticon_importer/plugininfo.xml > > Added: trunk/amsn-extras/plugins/emoticon_importer/emoticon_importer.tcl > =================================================================== > --- trunk/amsn-extras/plugins/emoticon_importer/emoticon_importer.tcl > (rev 0) > +++ trunk/amsn-extras/plugins/emoticon_importer/emoticon_importer.tcl > 2009-02-17 04:10:21 UTC (rev 11001) > @@ -0,0 +1,158 @@ > +################################################################### > +# aMSN Emoticon Importer Plugin # > +# By Youness Alaoui # > +# KaKaRoTo # > +# # > +################################################################### > + > +namespace eval ::emoticon_importer { > + variable config > + variable configlist > + > + > ####################################################################################### > + > ####################################################################################### > + #### Initialization Procedure (Called by the Plugins System) > #### > + > ####################################################################################### > + > ####################################################################################### > + > + proc Init { dir } { > + variable config > + variable configlist > + > + ::plugins::RegisterPlugin emoticon_importer > + > + array set config {} > + > + #Load lang files > + set langdir [file join $dir "lang"] > + set lang [::config::getGlobalKey language] > + load_lang en $langdir > + load_lang $lang $langdir > + > + set configlist [list [list frame > ::emoticon_importer::populateframe ""] ] > + } > + proc populateframe { win } { > + # Show some kind of UI for choosing a directory and importing > from it. > + } > + > + # Return value : > + # 0 : success > + # -1 : invalid field > + # -2 : smiley already exists with that name > + # -3 : could not find sound file > + # -4 : could not find the smiley file > + # -5 : file could not be loaded, wrong format or whatever > + # -6 : Error converting/resizing the file > + proc AddNewCustomEmoticon { name file text {casesensitive 0} {sound > ""}} { > + global custom_emotions HOME > + > + #Check for needed fields > + if { $name == "" || $file == "" || $text == "" } { > + return -1 > + } > + if { [info exists custom_emotions($name)] } { > + #Smiley exists > + return -2 > + } > + > + #Check for sound, and copy it > + if { $sound != "" } { > + set filename [getfilename [::skin::GetSkinFile sounds > $sound]] > + if { $filename == "null" } { > + return -3 > + } else { > + create_dir [file join $HOME sounds] > + catch { file copy [::skin::GetSkinFile sounds > $sound] [file join $HOME sounds]} > + } > + set emotion(sound) $filename > + } > + > + set filename [getfilename [::skin::GetSkinFile smileys $file]] > + if { $filename == "null" } { > + return -4 > + } > + > + create_dir [file join $HOME smileys] > + > + #Check for animation > + if { [ catch {set emotion(animated) [::picture::IsAnimated > [::skin::GetSkinFile smileys $file] ] } res ] } { > + #There is an error with the file, wront format or > doesn't exist > + return -5 > + } > + if { $emotion(animated) == 0 } { unset emotion(animated) } > + > + if { ![info exists emotion(animated)] || $emotion(animated) == > 0 } { > + image create photo tmp -file [::skin::GetSkinFile > smileys $file] > + > + set filetail_noext [filenoext [file tail $file]] > + set destfile [file join $HOME smileys $filetail_noext] > + > + if { [image width tmp] > 50 || [image height tmp] > 50 > } { > + #MSN can't show static smileys which are bigger > than 50x50 so we resize it > + set file [convert_image_plus > [::skin::GetSkinFile smileys $file] smileys 50x50] > + } else { > + #The smiley has size between 19x19 and 50x50 > and user doesn't want to resize it so we just convert it to PNG > + set filetail_noext [filenoext [file tail $file]] > + set destfile [file join $HOME smileys > $filetail_noext] > + ::picture::Convert [::skin::GetSkinFile smileys > $file] "${destfile}.png" > + set file "${destfile}.png" > + } > + > + # Don't forget to delete the temp image...! > + image delete tmp > + > + if { ![file exists $file] } { set file "" } > + } else { > + #We convert animated smiley to animated gif even if we > can just load animated gif and save to animated gif > + #Don't care of extension : as the smiley is animated > TkCximage will save to GIF format > + set filetail_noext [filenoext [file tail $file]] > + set destfile [file join $HOME smileys $filetail_noext] > + ::picture::Convert [::skin::GetSkinFile smileys $file] > "${destfile}.png" > + set file "${destfile}.png" > + if { ![file exists $file] } { set file "" } > + } > + > + if { $file == "" } { > + return -6 > + } > + > + set emotion(file) $file > + set emotion(name) $name > + set emotion(reachable) 1 > + > + #Create a list of symbols > + set emotion(text) [list] > + foreach symbol [split $text] { > + if { $symbol != "" } { > + lappend emotion(text) $symbol > + } > + } > + > + if { $casesensitive == 1} { > + set emotion(casesensitive) 1 > + } else { > + if { [info exist emotion(casesensitive)] } {unset > emotion(casesensitive)} > + } > + > + > + > + set emotion(image_name) [image create photo > emoticonCustom_std_$emotion(text) -file $emotion(file) -format cximage] > + set emotion(preview) [image create photo > emoticonCustom_preview_$emotion(text)] > + $emotion(preview) copy emoticonCustom_std_$emotion(text) > + > + set custom_emotions($name) [array get emotion] > + > + #load_smileys > + if { [winfo exists .smile_selector]} {destroy .smile_selector} > + > + #After modifying, clear sortedemotions, could need sorting again > + if {[info exists ::smiley::sortedemotions]} { unset > ::smiley::sortedemotions } > + > + > + #Immediately save settings.xml > + save_config > + > + return 0 > + } > + > +} > > Added: trunk/amsn-extras/plugins/emoticon_importer/plugininfo.xml > =================================================================== > --- trunk/amsn-extras/plugins/emoticon_importer/plugininfo.xml > (rev 0) > +++ trunk/amsn-extras/plugins/emoticon_importer/plugininfo.xml > 2009-02-17 04:10:21 UTC (rev 11001) > @@ -0,0 +1,19 @@ > +<?xml version="1.0"?> > +<plugin> > + <name>Emoticon Importer</name> > + <author>Youness Alaoui (a.k.a KaKaRoTo)</author> > + <description>Plugin that allows you to batch import multiple emoticons > into aMSN in one shot.</description> > + <amsn_version>0.95</amsn_version> > + <plugin_version>0.1</plugin_version> > + <plugin_file>emoticon_importer.tcl</plugin_file> > + <plugin_namespace>emoticon_importer</plugin_namespace> > + <init_procedure>Init</init_procedure> > + <cvs_version>10794</cvs_version> > + <URL> > + > <main>http://www.amsn-project.net/autoupdater/plugins/emoticon_importer/emoticon_imporer.tcl</main> > + > <plugininfo>http://www.amsn-project.net/autoupdater/plugins/emoticon_importer/plugininfo.xml</plugininfo> > + > <lang>http://www.amsn-project.net/autoupdater/plugins/emoticon_importer/lang/lang$langcode</lang> > + > <file>http://www.amsn-project.net/autoupdater/plugins/emoticon_importer/$file</file> > + </URL> > + > +</plugin> > > > This was sent by the SourceForge.net collaborative development platform, the > world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Amsn-commits mailing list > amsn-comm...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amsn-commits ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel