Shoutbox

erm... im not sure :S :( - 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: erm... im not sure :S :( (/showthread.php?tid=71113)

erm... im not sure :S :( by cameron.stokes3 on 01-28-2007 at 10:05 AM

code:
function OnEvent_SigninReady(sEmail){
var contacts = Messenger.MyContacts;
var online = 0;
var offline = 0;
for(var e = new Enumerator(contacts); !e.atEnd(); e.moveNext()){
item = e.item();
if(item.Status != 1 && item.Status != 0){
online++;
} else {
offline++;
}
}
MsgPlus.DisplayToast('Welcome!', 'Hello '+sEmail+' You have '+online+' contacts online.');
}


that is what i have so far... it all works and im happy with it but i want to take it one step further... how would i make it so instead of saying "Hello name@domain.com" its just says the first part of the email and disregards the @ and everything after it... so when you sign in it just says "Hello name"
RE: erm... im not sure :S :( by Felu on 01-28-2007 at 10:55 AM

code:
function OnEvent_SigninReady(sEmail){
    var Contacts = Messenger.MyContacts;
    var Online = 0;
    var Offline = 0
    var e = new Enumerator(Contacts);
    for(; !e.atEnd(); e.moveNext()) {
        if(e.item().Status > 2)
            Online++;
        else
            Offline++;
    }
    sName = sEmail.split("@")[0];
    MsgPlus.DisplayToast("Welcome "+sName, "You have "+Online+" Contacts online and "+Offline+" Contacts offline.");
}


RE: erm... im not sure :S :( by Matti on 01-28-2007 at 11:07 AM

Or, by using a substr():

code:
sName = sEmail.substr(0, sEmail.indexOf("@"));
MsgPlus.DisplayToast("Welcome "+sName, "You have "+Online+" Contacts online and "+Offline+" Contacts offline.");

RE: erm... im not sure :S :( by cameron.stokes3 on 01-28-2007 at 03:22 PM

thanks =]