| 1 | % |
| 2 | % anyremote configuration file: kopete example. (Server-mode) |
| 3 | % Prerequisites: kopete-anyremote plugin. |
| 4 | % |
| 5 | |
| 6 | % STATUS unknown |
| 7 | % XTEST no |
| 8 | % SOUND no |
| 9 | % ENV no |
| 10 | |
| 11 | GuiAppName=Kopete |
| 12 | GuiAppBinary=kopete |
| 13 | GuiAppRun=echo 'A=`dcop 2> /dev/null|grep kopete`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s |
| 14 | GuiAppIcon=kopete.png |
| 15 | GuiAppType=Example |
| 16 | GuiAppProtocols=Server |
| 17 | GuiAppDesc=Kopete, The KDE Instant Messenger Beware: support is still experimental. It needs to install kopete_anyremote |
| 18 | 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 |
| 19 | |
| 20 | [Protocol]=Server |
| 21 | |
| 22 | (Init)=Include($(CfgDir)/Utils/aliases-server.cfg);\ |
| 23 | 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');\ |
| 24 | 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); |
| 25 | |
| 26 | |
| 27 | (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);\ |
| 28 | Exec(dcop kopete MainApplication-Interface quit;kopete);\ |
| 29 | Macro(TEST_ICONS); |
| 30 | |
| 31 | Cancel=Timer(t1,cancel);Timer(t2,cancel);Exec(dcop kopete MainApplication-Interface quit); |
| 32 | |
| 33 | * *=Set(text,replace,Help,Kopete management\n1 - View contact list\n0 - Exit); |
| 34 | Back=Set(text,close); |
| 35 | Back($$)=Set(list,close);Timer(t1,cancel);Timer(t2,cancel); |
| 36 | |
| 37 | |
| 38 | 0=Timer(t1,cancel);Timer(t2,cancel);Exec(dcop kopete MainApplication-Interface quit);Exec(rm -f $HOME/.anyRemote/kopete-anyremote.*); |
| 39 | 1=Macro(INIT); |
| 40 | |
| 41 | INIT=Macro(STATUS1);Macro(MENU);Macro(STATUS);Macro(ACCOUNTS) |
| 42 | MENU=Set(menu,replace,Read,Send,Connect,Disconnect,Away,History,Clear History); |
| 43 | |
| 44 | TEST_ICONS=Get(is_exists,16,presence_away); |
| 45 | %IconExists(presence_away)=Exec(kdialog --msgbox "Icon exists"); |
| 46 | IconNotExists(presence_away)=Exec(kdialog --msgbox "Please wait. Uploading icons");Macro(UPLOAD1); |
| 47 | 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); |
| 48 | 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); |
| 49 | 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); |
| 50 | 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); |
| 51 | 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); |
| 52 | UPLOADEND=Exec(killall kdialog); |
| 53 | |
| 54 | %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;); |
| 55 | |
| 56 | 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); |
| 57 | STATUS =Timer(t1,5,0); |
| 58 | STATUS1=Timer(t2,1,5); |
| 59 | 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;}'); |
| 60 | |
| 61 | t1=Macro(STATUS_ONCE) |
| 62 | t2=Macro(STATUS_ONCE) |
| 63 | |
| 64 | 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); |
| 65 | |
| 66 | 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); |
| 67 | 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); |
| 68 | 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); |
| 69 | |
| 70 | 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); |
| 71 | |
| 72 | Connect($$)=Exec(dcop kopete KopeteIface connectAll); |
| 73 | Disconnect($$)=Exec(dcop kopete KopeteIface disconnectAll); |
| 74 | Away($$)=Exec(dcop kopete KopeteIface setAway); |
| 75 | |
| 76 | |
| 77 | [Mode]=SEND |
| 78 | |
| 79 | BACK=Make(mode,default);Macro(STATUS_ONCE);Macro(STATUS);Macro(MENU); |
| 80 | |
| 81 | Ok($$)=Exec(dcop kopete KopeteIface messageContact `cat $HOME/.anyRemote/kopete-anyremote.sendto` $(Param));Macro(BACK); |
| 82 | Back($$)=Macro(BACK); |
| 83 | |
| 84 | [ModeEnd] |
| 85 | |
| 86 | [Mode]=READ |
| 87 | |
| 88 | (ExitMode)=Macro(STATUS);Macro(MENU); |
| 89 | 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); |
| 90 | |
| 91 | [ModeEnd] |
| 92 | |
| 93 | [End] |