What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Contacts - Using the wrong status

[?] Contacts - Using the wrong status
Author: Message:
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: [?] Contacts - Using the wrong status
The only problem that I can possibly see is that you are not setting the icon to the correct item.

For example:

At the start, I'll assume you have no items in the ListView. Then through:
code:
Wnd.LstView_AddItem('contacts', Contact.Email, 0);
Now you have 1 contact item in the list with an index of 0. But when you set the item's icon:
code:
Wnd.LstView_SetItemIcon('contacts', Wnd.LstView_GetCount('contacts'), StatusImg[Contact.Status], true);
The GetCount will be 1 (because you have 1 item in the list), but what you want to have is 0 (the index of your item). So you need to take away 1 each time you use the GetCount. Or even better, store the count at the start of the loop before you add the item and use that.

Two possible fixes (haven't tested):
code:
var StatusImg = new Array('','Offline', 'Online'/*Current User*/, 'Online'/*Contact*/, 'Busy', 'Away', 'Away', 'Away', 'Busy', 'Away','Blocked',"Blocked-offline");

var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext()) {
    var Contact = e.item();
    Wnd.LstView_AddItem('contacts', Contact.Email, 0);
    Wnd.LstView_SetItemIcon('contacts', Wnd.LstView_GetCount('contacts')-1, StatusImg[Contact.Status], true);
    if(Contact.Blocked==true&&Contact.Status!=1)Wnd.LstView_SetItemIcon('contacts', Wnd.LstView_GetCount('contacts')-1, StatusImg[10], true);
    if(Contact.Blocked==true&&Contact.Status==1)Wnd.LstView_SetItemIcon('contacts', Wnd.LstView_GetCount('contacts')-1, StatusImg[11], true);
    Debug.Trace("Contact Status: "+Contact.Status+" | StatusImg["+Contact.Status+"] = '"+StatusImg[Contact.Status]+"'");
}
code:
var StatusImg = new Array('','Offline', 'Online'/*Current User*/, 'Online'/*Contact*/, 'Busy', 'Away', 'Away', 'Away', 'Busy', 'Away','Blocked',"Blocked-offline");

var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext()) {
    var Contact = e.item();
    var Count = Wnd.LstView_GetCount('contacts');
    Wnd.LstView_AddItem('contacts', Contact.Email, 0);
    Wnd.LstView_SetItemIcon('contacts', Count, StatusImg[Contact.Status], true);
    if(Contact.Blocked==true&&Contact.Status!=1)Wnd.LstView_SetItemIcon('contacts', Count, StatusImg[10], true);
    if(Contact.Blocked==true&&Contact.Status==1)Wnd.LstView_SetItemIcon('contacts', Count, StatusImg[11], true);
    Debug.Trace("Contact Status: "+Contact.Status+" | StatusImg["+Contact.Status+"] = '"+StatusImg[Contact.Status]+"'");
}
Hope it works.
10-06-2007 01:13 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] Contacts - Using the wrong status - by Spunky on 10-05-2007 at 08:35 PM
RE: [?] Contacts - Using the wrong status - by vikke on 10-05-2007 at 08:48 PM
RE: [?] Contacts - Using the wrong status - by Spunky on 10-05-2007 at 10:47 PM
RE: RE: [?] Contacts - Using the wrong status - by vikke on 10-05-2007 at 11:02 PM
RE: [?] Contacts - Using the wrong status - by Chris4 on 10-05-2007 at 10:59 PM
RE: [?] Contacts - Using the wrong status - by Spunky on 10-05-2007 at 11:08 PM
RE: [?] Contacts - Using the wrong status - by phalanxii on 10-06-2007 at 01:13 AM
RE: [?] Contacts - Using the wrong status - by markee on 10-06-2007 at 01:58 AM
RE: [?] Contacts - Using the wrong status - by Spunky on 10-06-2007 at 05:19 PM
RE: [?] Contacts - Using the wrong status - by Chris4 on 10-07-2007 at 02:08 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On