• Welcome to Valhalla Legends Archive.
 

OP holders not staying on top of listview.

Started by Crypticflare, March 04, 2003, 12:16 PM

Previous topic - Next topic

Crypticflare

When I join a channel the ops go to the top of the listview. my problem is on the bots textbot, say i type /join Clan CF and I see the op holder CF there, I'd go to join "public chat 1", then I'd go back to Clan CF, and the op holder isn't on top of the listview anymore, is there a property on the listview table I can set so the op holder always stays on top.. like with the arrangement of icons, or do I have to hardcode it into the bot?

ILurker

#1
use a code like this for when someone is in the channel
dim icon as integer
icon = geticoncode(client, flags)
Dim lagicoN As Integer
lagicoN = GetLagIcon(Ping, Flags)
 If icon = ICON_GAVEL Then
    With form1.ChannelList.ListItems.add(1, username, username, , icon)
    .ListSubItems.add ChannelList.FindItem(username).Index, , , lagicoN
    End With
 End If
 If icon <> ICON_GAVEL Then
    With form1.ChannelList.ListItems.add(, , username, , icon)
    .ListSubItems.add , , , lagicoN
    End With


Do the same for when someone joins the channel
for when someone leaves the channel do this

form1.ChannelList.ListItems.Remove form1.ChannelList.FindItem(username).Index
form1.ChannelList.Refresh

make sure when you join a channel it automatically clears the channellist

channellist.listitems.clear

Camel

#2
never done it, but i imagine the easiest way would be to make an extra column and sort by its value
blizz reps = 0
speaker = 1
op = 5
all other users = gettickcount (when they join)

*shrug*

Grok

If you're using a listview, this is easy.  Make the listview sortable.  Create a column header for priority and set the sort column to it.  As you add each user, add the item to the listview, set the subitem for priority appropriately.  Your listview will stay sorted.  Here's an example:

10 - Blizzard icons like Admin
20 - Possibly speaker and other important icons
30 - Ops (hammer)
40 - Clan members maybe
90 - Everyone else

Don't numbers close together, in case you change your mind and want to sort someone between say 2 and 3.

The listview will put all 10's first, 20's, etc.  You never have to worry about sorting again.

Edit:  You can make the sort priority column invisible by setting its column-width to 0.  Creating subitems is a neat way to do various sorts.

Crypticflare

#4
ah ok, I see how to do it now, thanks!

Spht

You're going to have to do better than that if you want it to properly arrange the names when new special flagged users are added. In ILurker's case, as the bot finds new channel operators, they will be throw directly to the top. Which means, when he joins a channel with two or more channel operators, they will be listed in the opposite order in which they are in the channel (most recently found names will be at top). So I'd suggest creating a GetPlacementIndex() function which will tell the list view where to add the new special user based on recently added special users so that the special user order is in the order that they are actually in the channel.

Camel

#6
QuoteYou can make the sort priority column invisible by setting its column-width to 0.  Creating subitems is a neat way to do various sorts.
so you could create a subitem with gettickcount, so you revert to when they joined, eh?

ILurker

#7
while we're in this topic, i was wondering why it doesnt show someone as a moderator icon when they join the channel.
for example, if i was in clan boo and boo joined
it doesnt show hiom as a moderator
only when i join

Spht

#8
Quotewhile we're in this topic, i was wondering why it doesnt show someone as a moderator icon when they join the channel.
for example, if i was in clan boo and boo joined
it doesnt show hiom as a moderator
only when i join

Obviously because he's wasn't a moderator before the joined the channel. The status is only acquired after the user is present in the channel.

You'll notice that Blizzard employees always carry this flag, because they would be moderators in any channel - it's not dependant on the channel they're in.

ILurker

Is there any way which i could make it show him as a moderator tho?

i noticed that when you unignore someone bnet sends you a flag update of everyone in the channel you are in, i could use that for when someone joins the channel it automatically attempts to unignore the logged on account, then uses the updates the re-ad everyone to the list, but this would flood the bot allot

Camel

#10
QuoteIs there any way which i could make it show him as a moderator tho?

i noticed that when you unignore someone bnet sends you a flag update of everyone in the channel you are in, i could use that for when someone joins the channel it automatically attempts to unignore the logged on account, then uses the updates the re-ad everyone to the list, but this would flood the bot allot

you shouldn't have to do that...bnet will always send you the correct flag when someone gets ops
if your bot doesn't show someone as ops taht should have ops, you are parsing it wrong

Camel

truely a simple thing to do :)
(obviously, that column will be hidden)



If Flags And &H40 Then SortOrder = 4 'blizz guest
If Flags And &H4 Then SortOrder = 3 'speaker
If Flags And &H2 Then SortOrder = 2 'op
If Flags And &H8 Then SortOrder = 1 'bnet rep
If Flags And &H1 Then SortOrder = 0 'blizz rep

Zakath

#12
Battle.net does send a flags update message (EventID 0x09 in the 0x0f packet) when someone becomes an operator while in a channel.

I created an UpdateUser() function that takes parameters corresponding to the new info in this packet and makes the appropriate changes to the user in the list, such as changing their icon, and notifying the user that someone has become an operator).
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

ILurker

#13
Thx

Mesiah / haiseM

#14
No it doesnt update it, but in order for somebody to recive ops, they have to join under the clan name account, or rejoin when they are designated, either way it shows up in the flags under the corresponding event..., somebody cant just be in the channel and automatically receive ops...
]HighBrow Innovations
Coming soon...

AIM Online Status: