Shoutbox

Question :) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Question :) (/showthread.php?tid=82713)

Question :) by WaterRatj on 03-27-2008 at 03:55 PM

Some questions while i'm learning a bit.

1) Is it possible to find out on recievedmessage if a file is being sent?
   1.a) If so is it possible to autoaccept?
2) Is it possible in a group conversation, to find out what email sended a message?
3) Is it possible to find out if someone is adding your email?
   3.a) Is it possible to autoaccept it then?

Some questions if somone can help me out with :)
Thanks


RE: Question :) by Quantum on 03-27-2008 at 04:27 PM

1.a Yes you can do this without a script. In your Plus! prefs go to the conversation tab and at the bottom you will see "Auto Accept Requests". Check the box and choose from the drop down menu file transfers.

2 Don't know what you mean.

3. You get a little window that comes up and asks you to accept.
3.a I don't think so but i could be wrong.


RE: Question :) by MeEtc on 03-27-2008 at 04:43 PM

1. AFAIK, you cannot detect file transfers with scripting on its own. You will need a packet sniffer, such as Xniff that you will find here in the forum.
   a. What john-t said: Plus can auto-accept activities including file transfers.

2. It can be difficult to determine in a 2 person conversation to find out which email address sent a particular message. There are code samples on the forum somewhere. I'll edit this post when i find some examples.

3. See 1. Not without a packet sniffer.
   a. If you get the email address of the person trying to add you, check out this script by deAd


RE: Question :) by WaterRatj on 03-27-2008 at 05:02 PM

Okay, Thanks for answering :)
I'll also look further :)

That helped me a bit :)


Stupid Question? :P

I'm trying to split something

var sPrefix = sMessage.split(" ");
var sPrefixTheRest = ???

Lets say the string is !nick Hello Kitty.

sPrefix[0] will be !nick

But i' trying to the a string now with all the rest of the line without the !nick, can anyone tell me hows the best way to do this?
RE: Question :) by CookieRevised on 03-28-2008 at 12:22 AM

quote:
Originally posted by WaterRatj
I'm trying to split something

var sPrefix = sMessage.split(" ");
var sPrefixTheRest = ???

Lets say the string is !nick Hello Kitty.

sPrefix[0] will be !nick

But i' trying to the a string now with all the rest of the line without the !nick, can anyone tell me hows the best way to do this?
split() is usually only good if you want to turn something into an array or if you are absolutely certain that a certain string includes the exact amount of delimiters and items you want. Now, it can be done with the very slow split() function though, but you will need a lot of stuff and trickery and in the end it would still not be fail-proof.

As a first simple alternative:

code:
var mystring = "!nick Hello Kitty";

// Search the first space in the string
var X = mystring.indexOf(" ");
// Increase the index by one (we don't want the space itself)
X = X + 1;
// Get everything after the space, thus starting from the character at position X till the end
mystring = mystring.substr( X );
combined into one line:
code:
mystring = mystring.substr(mystring.indexOf(" ") + 1);

But if that string is something entered by the user (like a command):
Then what if the user forget to type anything behind "!nick"?
And what if the user forget the space after "!nick"?
And what if the user has typed spaces before "!nick"?
And what if the user has typed multiple spaces after "!nick"?
etc...

All these things need to be taken care of.

If you want to seperate the parameters from the command in an OnEvent_ChatWndSendMessage function, you better use regular expressions. This is the most accurate and versitile method to use for this. For an explaining example see CookieRevised's reply to Gettin data from "/" commands.

PS: do not use "!" as prefix for normal commands. A normal local command should always have "/" as prefix. Most likely, Your script isn't the only script the user is using. Using something different for the prefix than the usual prefix may confuse the user and it will give problems with some other scripts also, etc.

;)
RE: Question :) by WaterRatj on 03-28-2008 at 12:31 AM

tnx for the help :p
I'll be on my way for a bit now with scripting :)
Thanks