aMSN Forums
May 24, 2013, 09:32:46 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: which procs can i use with amsn-remote-CLI?  (Read 3819 times)
luke89
Newbie

Offline Offline

Posts: 34


View Profile
« on: July 10, 2006, 02:19:10 pm »

Hi to you all!!

Just a simple question...
with amsn-remote-CLI i can use only the procs in the remote.tcl file (::remote)?
If, the answer is no, how can i use procs from ::skin, for examble?

Did i make myself clear?

Thanks, bye

Luca
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9428


View Profile WWW
« Reply #1 on: July 14, 2006, 05:03:24 pm »

Hi,
you can only use the procs from remote.tcl, all commands are prefixed with "::remote::" to make sure it is from the remote namespace. This is obviously for security reasons.

Why would you need to use the skin functions ? what exactly do you want to do ? if you can give me a good reason, I may implement them for you.

p.s.: you could still write a simple wrapping proc in remote.tcl like :
Code:
proc ::remote::skin_wrap { args } { eval ::skin::function_you_want_to_call $args }

or maybe even better BUT a lot less secure :
Code:
proc ::remote::eval { args } { eval $args }

then you could call it in amsn-remote prompt by doing :
Code:
eval ::skin::whatever your_args
Logged

KaKaRoTo
luke89
Newbie

Offline Offline

Posts: 34


View Profile
« Reply #2 on: July 14, 2006, 05:35:43 pm »

I said the ::skin because it was the first eval that came into my mind...
Btw... from the begin...
I'm trying to make an action in kde that let me send a file with a right click.
I made a proc called "::remote::online2", that return me all the online contacts on a single line
I can't use ::remote::online because it returns a contact per line and sending the output of amsn-remote-CLI to a file, it will save only the first online contact and all the others are lost. :S

So i thought "i can write the online2 proc in a file and load it as a plugin called myPlug", but i can't run the ::myPlug::online2 proc from amsn-remote-CLI.
So, i always have to add my proc to the remote.tcl every time i re-download the amsn_dev.tar.gz

I don't know if i made myself clear. If not, tell me and i'll try to explain myself better.

Sorry for my english... i'm italian Cheesy

Thanks kakaroto for your answer.
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9428


View Profile WWW
« Reply #3 on: July 14, 2006, 07:32:56 pm »

hi,
if I'm right, you already opened a forum thread about this, why create yet another thread ? anyways.. also your thread should be in development forum not in support...
to answer you, yes, I understand now better.. but I don't know why you'd need a separate 'online2' proc... you can create a script that reads the input, like doing :
Code:
echo -ne "localhost\nUSERNAME\nPASSWORD\nonline\nquit\n" | ./amsn-remote-CLI | your_script

the script could read line by line from stdin (the output of amsn-remote-CLI since it's piped) and read until it finds the line 'online' which means the next lines will be the output of 'online' (until the line 'quit'), there, you could use sed or awk or whatever to get the first word from each line, actually, you could do a
Code:
echo $LINE | grep -e ".* - " -o | awk {whatever awk instruction to print the first word}

and there, you have the email of each contact...
anyways, as I said, you could write a function in remote.tcl that would call
Code:
eval ::myPlug::online2 $args

Also, having it as a plugin is a good idea, and you don't NEED to have your online2 proc inside the 'myplug' namespace... once your plugin is loaded, you can whatever you want, for example, you can have this code :
Code:
proc ::remote::online2 {} { ... .}
inside your plugin's code and the online2 function will become part fo the 'remote' namespace... nothing forces you to have it inside your namespace... look at the emotes plugin as a proof of concept to see how you can create whatever you want or hook existing procs if you want.

Another thing, you say you download amsn_dev.tar.gz every time... that's bad, it uses a lot of bandwidth, my suggestion is to use the 'svn' commands directly, this way a 'svn update' will be done in less than a second and your changes will be merged and you won't loose them (if a conflict happens, then you got a problem though, you'd need to fix it or to delete the file and redo 'svn update' then readd your changes)
read the sourceforge page to see how to use the svn command.
Logged

KaKaRoTo
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!