Author Topic: Whoson Script...  (Read 6282 times)

Socom

  • Guest
Whoson Script...
« on: May 04, 2009, 07:58:28 PM »
I tried searching but didnt find anything .. what I am looking for is..

someone does a !wholeader and it checks all the users on the channel and sees if any of the names in a list match.. if so it lists those people.

Only other problem is lot of these people change nicks, so I would either need to put it something like this..


Bob123 | Bob123-Away | and it knows they are both him

or maybe it searches by there  host mask?

Thanks

Socom

  • Guest
Re: Whoson Script...
« Reply #1 on: May 04, 2009, 08:01:50 PM »
maybe list it like...

Currently Online: blah blah blah
Currently Offline: blah blah blah

that would be awesome.

:)


Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Whoson Script...
« Reply #2 on: May 15, 2009, 10:35:20 AM »
Are you looking to match it with a list of users saved somewhere?
The IceChat God

Socom

  • Guest
Re: Whoson Script...
« Reply #3 on: May 16, 2009, 08:08:13 PM »
I would guess I would need to. Like text file.

Something that had there nick(s) and maybe hostmast?

If I could add people to the group with a command that would be cool, but there are not many people so doing it manually would be fine as well.

Sorry for the delay, reinstalled my system.. took a bit to make my way back here :)

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Whoson Script...
« Reply #4 on: May 18, 2009, 10:38:32 AM »
Save this to an IceChat 5 (.ICE) style script.

It will auto-load the script and users after you load and save the script.
To add a user type this:

Code: [Select]
/! AddUser Nickname

You can add alias to make it easier
Code: [Select]
/add /! AddUser $1
And then just type /add Nickname.

It only works with single users names for the time being, but see how that works for you.


Code: [Select]
dim users
dim userini
dim totalusers

userini = "users.ini"

Set users = CreateObject("Scripting.Dictionary")

call ReadUsers()

Sub ReadUsers()
i = 1
users.RemoveAll
do
    user = getinifile(userini, "Users","User" & i, "")
    if len(user) > 0 then
        users.add cstr(i), user
        i = i + 1
    else
        exit do
    end if
loop
totalusers = i - 1
SendCommand "/echo -a Loaded " & totalusers & " users into Whoson Script"
End Sub

Sub AddUser(user)
totalusers = totalusers + 1
writeinifile userini, "Users", "User" & totalusers,user
users.add totalusers, user
SendCommand "/echo -a Added " & user & " to Whoson Database (" & totalusers & " total)"
End Sub

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
if Message = "!wholeader" then
    dim whoson, whosoff, allnicks, tnicks, whosonnicks, found
    allnicks = Nicks(Channel, ServerNumber)
    tnicks = split(allnicks, " ")   
    whosonnicks = users.Items

        for i = 0 to users.Count - 1
            found = False
            SendCommand "/echo -a checking " & whosonnicks(i)
            for x = 0 to ubound(tnicks)       
                if lcase(whosonnicks(i)) = lcase(tnicks(x)) then
                    whoson = whoson & " " & whosonnicks(i)
                    Found = True   
                end if
            next
            if found = False then
                whosoff = whosoff & " " & whosonnicks(i)
            end if
        next

    SendCommand "/msg " & Channel & " Currently Online:" & whoson, ServerNumber   
    SendCommand "/msg " & Channel & " Currently Offline:" & whosoff, ServerNumber   
end if
End Sub

Function OUTTEXT(OutgoingText)
OutText = OutGoingText
if OutGoingText = "!wholeader" then
    dim cs, allnicks,tnicks,whosonnicks, Channel, found
    cs = GetIdentifier("$csn")
    if GetIdentifier("$currentwindowtype") = 2 then
        Channel = GetIdentifier("$currentwindow", cs)
        allnicks = Nicks(Channel, cs)
        tnicks = Split(allnicks, " ")   
        whosonnicks = users.Items
       
        for i = 0 to users.Count - 1
            found = False
            SendCommand "/echo -a checking " & whosonnicks(i)
            for x = 0 to ubound(tnicks)       
                if lcase(whosonnicks(i)) = lcase(tnicks(x)) then
                    whoson = whoson & " " & whosonnicks(i)
                    Found = True   
                end if
            next
            if found = False then
                whosoff = whosoff & " " & whosonnicks(i)
            end if
        next
       
        SendCommand "/msg " & Channel & " Currently Online:" & whoson, cs
        SendCommand "/msg " & Channel & " Currently Offline:" & whosoff, cs
                   

    end if
end if
End Function
The IceChat God

Socom

  • Guest
Re: Whoson Script...
« Reply #5 on: May 19, 2009, 07:09:15 PM »
Ok, semi works :)

I added 6 people, two were myself (on two different irc programs for testing)

Of the 6 people I added only 1 was offline.

However, the script thinks everyone but my two are offline.

Nicks on the these 6 match exact right now.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Whoson Script...
« Reply #6 on: May 20, 2009, 08:33:10 AM »
Ok, they check if they are in the channel that you are running the command in, is that what you doing?
The IceChat God

Socom

  • Guest
Re: Whoson Script...
« Reply #7 on: May 20, 2009, 10:26:03 AM »
Ahhh! It only shows those in the channel you are currently in! well that makes sense :) ok works perfect at this point then :)

So, the few thins I would love to have, just let me know if possible or way to much work are...

1) Somehow it knows based on there hostname (or I can set multiple nicks for the same user)
2) Can display if the are online by 'away' (have to read the whois I would imagine)
3) Can add an info line
4) Can I set them up as even tables

Examples of what I mean:

Socom - Leader - ONLINE
Bob     - MoIA   - ONLINE
Frank  - MoFA   - ONLINE

George - MoD    - Away
Ed       - MoF    - Away

Teddy  - Sec    - Offline
Jose    - Council - Offline

Well let me know, and thank you for all your help so far!

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Whoson Script...
« Reply #8 on: May 20, 2009, 11:07:19 AM »
I can try and make it work so you can have multiple names, but you are going to have to try and figure out the rest of it.
Doing Whois information and all that is really going to make a mess of it.
The IceChat God

Socom

  • Guest
Re: Whoson Script...
« Reply #9 on: May 20, 2009, 11:24:37 AM »
what about just being able to add the tag line? I figured the whois to grab the away would be pretty hard..  :/

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Whoson Script...
« Reply #10 on: May 20, 2009, 12:59:16 PM »
Either way, adding multiple nicks and a tag line will require a lot of re-writing.

And I take it you don't want to try it yourself, so, will just have to wait until I have some more time again.
The IceChat God

Socom

  • Guest
Re: Whoson Script...
« Reply #11 on: May 20, 2009, 02:26:22 PM »
I did try myself.. but.. apparently I have no knack for this. I will give it a try some more.. and if I come up with anything ill let you know, otherwise, whatever you can do would be greatly appreciated.. and thanks again for your help.

Socom

  • Guest
Re: Whoson Script...
« Reply #12 on: May 20, 2009, 08:02:51 PM »
Talked with some people, they like it the way you have it setup now.. how it lists them. So.. no changes needed. Other then if we can do multiple nicks.