% % anyremote configuration file: kopete example. (Server-mode) % Prerequisites: kopete-anyremote plugin. % % STATUS unknown % XTEST no % SOUND no % ENV no GuiAppName=Kopete GuiAppBinary=kopete GuiAppRun=echo 'A=`dcop 2> /dev/null|grep kopete`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s GuiAppIcon=kopete.png GuiAppType=Example GuiAppProtocols=Server GuiAppDesc=Kopete, The KDE Instant Messenger Beware: support is still experimental. It needs to install kopete_anyremote GuiAppVersion=echo 'V=`kopete -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`; if [ "x$V" == "x3" ]; then echo OK; else echo NOK; fi'|bash -f -s [Protocol]=Server (Init)=Include($(CfgDir)/Utils/aliases-server.cfg);\ Exec(bash -c 'A=`ls /usr/lib/kde3/|grep kopete_anyremote|wc -l`; if [ "x$A" == "x0" ]; then kdialog --msgbox "Make sure You have installed kopete-anyremote plugin."; fi');\ Exec(echo 'V=`amarok -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`;if [ "x$V" == "x4" ]; then $(CfgDir)/Utils/message.sh "ERROR: this configuration file is for KDE3"; fi'|bash -f -s); (Connect)=Set(icons,Kopete,1,plus,2,default,3,default,4,default,5,default,6,default,7,default,8,default,9,default,*,question,0,no,#,default);\ Exec(dcop kopete MainApplication-Interface quit;kopete);\ Macro(TEST_ICONS); Cancel=Timer(t1,cancel);Timer(t2,cancel);Exec(dcop kopete MainApplication-Interface quit); * *=Set(text,replace,Help,Kopete management\n1 - View contact list\n0 - Exit); Back=Set(text,close); Back($$)=Set(list,close);Timer(t1,cancel);Timer(t2,cancel); 0=Timer(t1,cancel);Timer(t2,cancel);Exec(dcop kopete MainApplication-Interface quit);Exec(rm -f $HOME/.anyRemote/kopete-anyremote.*); 1=Macro(INIT); INIT=Macro(STATUS1);Macro(MENU);Macro(STATUS);Macro(ACCOUNTS) MENU=Set(menu,replace,Read,Send,Connect,Disconnect,Away,History,Clear History); TEST_ICONS=Get(is_exists,16,presence_away); %IconExists(presence_away)=Exec(kdialog --msgbox "Icon exists"); IconNotExists(presence_away)=Exec(kdialog --msgbox "Please wait. Uploading icons");Macro(UPLOAD1); UPLOAD1=ExecAndSet(image,icon,echo 'F=`find /usr/share/icons -name presence_away.png|grep 16|head -1`;echo "presence_away,$F"'|bash -f -s);Macro(UPLOAD2); UPLOAD2=ExecAndSet(image,icon,echo 'F=`find /usr/share/icons -name presence_online.png|grep 16|head -1`;echo "presence_online,$F"'|bash -f -s);Macro(UPLOAD3); UPLOAD3=ExecAndSet(image,icon,echo 'F=`find /usr/share/icons -name presence_offline.png|grep 16|head -1`;echo "presence_offline,$F"'|bash -f -s);Macro(UPLOAD4); UPLOAD4=ExecAndSet(image,icon,echo 'F=`find /usr/share/icons -name presence_unknown.png|grep 16|head -1`;echo "presence_unknown,$F"'|bash -f -s);Macro(UPLOAD5); UPLOAD5=ExecAndSet(image,icon,echo 'F=`find /usr/share/icons -name connect_creating.png|grep 16|head -1`;echo "connect_creating,$F"'|bash -f -s);Macro(UPLOADEND); UPLOADEND=Exec(killall kdialog); %CREATE_STATUS_TABLE=Exec(echo "Unknown,question" > /$HOME/.anuRemote/kopete.stts;echo "Offline,no" >> /$HOME/.anuRemote/kopete.stts;echo "Connecting,refresh" >> /$HOME/.anuRemote/kopete.stts;echo "Invisible,fit" >> /$HOME/.anuRemote/kopete.stts;echo "Away,presence_away" >> /$HOME/.anuRemote/kopete.stts;echo "Online,presence_online" >> /$HOME/.anuRemote/kopete.stts;echo "Msg,file" >> /$HOME/.anuRemote/kopete.stts;); ACCOUNTS=Exec(echo 'A=`dcop kopete KopeteIface accounts|wc -l`;if [ "x$A" == "x1" ]; then true; else kdialog --msgbox "There is more than one account defined in Kopete. Sending messages will not work."; fi'|bash -f -s); STATUS =Timer(t1,5,0); STATUS1=Timer(t2,1,5); STATUS_ONCE=ExecAndSet(iconlist,replace,Contacts,bash -c 'F=$HOME/.anyRemote/kopete-anyremote.status;if [ -f $F ]; then cat $F; fi'|awk '{split($0,a,";");st = "presence_unknown";if (a[3]=="Offline") {st = "presence_offline"}; if (a[3]=="Connecting") {st = "connect_creating"};if (a[3]=="Invisible") {st = "presence_unknown"};if (a[3]=="Away") {st = "presence_away"};if (a[3]=="Online") {st = "presence_online"};if (a[3]=="Msg") {st = "file"};s=sprintf("%s:%s,",st,a[2]);print s;}'); t1=Macro(STATUS_ONCE) t2=Macro(STATUS_ONCE) RESET_STATUS=Exec(rm -f $HOME/.anyRemote/kopete-anyremote.status.rr;ID=`cat $HOME/.anyRemote/kopete-anyremote.status|head -$(Index)|tail -1|cut -f 1 -d ";"`;export ID;cp $HOME/.anyRemote/kopete-anyremote.status $HOME/.anyRemote/kopete-anyremote.status.rr; cat $HOME/.anyRemote/kopete-anyremote.status.rr|awk '{i=ENVIRON["ID"];if (index($0,i)>0) {split($0,a,";");out=sprintf("%s;%s;%s",a[1],a[2],a[4]);print out;} else {print $0;} }' > $HOME/.anyRemote/kopete-anyremote.status;rm -f $HOME/.anyRemote/kopete-anyremote.status.rr); Read($$)=ExecAndSet(text,replace,Message,echo 'ID=`cat $HOME/.anyRemote/kopete-anyremote.status|head -$(Index)|tail -1|cut -f 1 -d ";"`;if [ -f $HOME/.anyRemote/kopete-anyremote.msg.$ID ]; then cat $HOME/.anyRemote/kopete-anyremote.msg.$ID; cat $HOME/.anyRemote/kopete-anyremote.msg.$ID >> $HOME/.anyRemote/kopete-anyremote.msg.$ID.history; rm -f $HOME/.anyRemote/kopete-anyremote.msg.$ID;fi'|bash -f -s);Timer(t1,cancel);Timer(t2,cancel);Macro(RESET_STATUS);Make(mode,READ); History($$)=ExecAndSet(text,replace,Message,echo 'ID=`cat $HOME/.anyRemote/kopete-anyremote.status|head -$(Index)|tail -1|cut -f 1 -d ";"`;if [ -f $HOME/.anyRemote/kopete-anyremote.msg.$ID.history ]; then cat $HOME/.anyRemote/kopete-anyremote.msg.$ID.history; else echo "History empty"; fi'|bash -f -s);Make(mode,READ); Clear History($$)=Exec(echo 'ID=`cat $HOME/.anyRemote/kopete-anyremote.status|head -$(Index)|tail -1|cut -f 1 -d ";"`;if [ -f $HOME/.anyRemote/kopete-anyremote.msg.$ID.history ]; then rm -f $HOME/.anyRemote/kopete-anyremote.msg.$ID.history; fi'|bash -f -s); Send($$)=Exec(echo `head -$(Index) $HOME/.anyRemote/kopete-anyremote.status|tail -1|cut -d ':' -f 3|cut -d ';' -f 1`>$HOME/.anyRemote/kopete-anyremote.sendto);Set(editfield,Send,Message,Hi);Timer(t1,cancel);Timer(t2,cancel);Make(mode,SEND); Connect($$)=Exec(dcop kopete KopeteIface connectAll); Disconnect($$)=Exec(dcop kopete KopeteIface disconnectAll); Away($$)=Exec(dcop kopete KopeteIface setAway); [Mode]=SEND BACK=Make(mode,default);Macro(STATUS_ONCE);Macro(STATUS);Macro(MENU); Ok($$)=Exec(dcop kopete KopeteIface messageContact `cat $HOME/.anyRemote/kopete-anyremote.sendto` $(Param));Macro(BACK); Back($$)=Macro(BACK); [ModeEnd] [Mode]=READ (ExitMode)=Macro(STATUS);Macro(MENU); Back=ExecAndSet(iconlist,replace,Contacts,bash -c 'F=$HOME/.anyRemote/kopete-anyremote.status;if [ -f $F ]; then cat $F; fi'|awk '{split($0,a,";");st = "presence_unknown";if (a[3]=="Offline") {st = "presence_offline"}; if (a[3]=="Connecting") {st = "connect_creating"};if (a[3]=="Invisible") {st = "presence_unknown"};if (a[3]=="Away") {st = "presence_away"};if (a[3]=="Online") {st = "presence_online"};if (a[3]=="Msg") {st = "file"};s=sprintf("%s:%s,",st,a[2]);print s;}');Make(mode,default); [ModeEnd] [End]