1. I've run into a rather furstrating problem I can't seem to figure out, and after much hair pulling, I've decided to ask here.

    I've written an addon to block all whispers from people not in my guild or on my friends list, it sends them a whisper back saying they've been blocked and all is working perfectly, but then I wanted to add a feature to "whitelist" other guilds (alt guild in my case), so I created a saved variable and added a slash command, all that works great.

    The problem I am having, is, I'm using WhoLib to do my who lookups for me, I have my message filter doing it's business, it checks if they're on my friends list, then in my guild, if they're not, it does a who lookup, then tries to access what should be a table full of who data, but it's empty because the who callback hasn't fired yet so I get a nil error. I've tried everything I could think of to get around it, all to no avail. I need to check in the message filter event right after I call the who request because if I do it outside, even if they're whitelisted, it still blocks the whisper.

    Here is the function in question:

    function IncFilter()

        local player = arg2

        if not IsFriend(player) then

            if not IsGuildMember(player) then

                if not Warned[player] then

                    WhoInfo = Who:WhoLookup(player)

                    if not IsAllowedGuild(WhoInfo.guild) then

                        return true

                    end

                else

                    return true

                end

            end

        end

    end

    Is there any way I can pause or wait for the callback to happen? I tried creating a variable WhoIsDone, setting it to true in the who callback function and then creating a loop waiting for it to be set to true, but it just went into an infinate loop and crashed wow lol

    I can paste the other functions if required.

    Any help appreciated.

    I've run into a rather furstrating problem I can't seem to figure out, and after much hair pulling, I've decided to ask here.

    I've written an addon to block all whispers from people not in my guild or on my friends list, it sends them a whisper back saying they've been blocked and all is working perfectly, but then I wanted to add a feature to "whitelist" other guilds (alt guild in my case), so I created a saved variable and added a slash command, all that works great.

    The problem I am having, is, I'm using WhoLib to do my who lookups for me, I have my message filter doing it's business, it checks if they're on my friends list, then in my guild, if they're not, it does a who lookup, then tries to access what should be a table full of who data, but it's empty because the who callback hasn't fired yet so I get a nil error. I've tried everything I could think of to get around it, all to no avail. I need to check in the message filter event right after I call the who request because if I do it outside, even if they're whitelisted, it still blocks the whisper.

    Here is the function in question:

    function IncFilter()

        local player = arg2

        if not IsFriend(player) then

            if not IsGuildMember(player) then

                if not Warned[player] then

                    WhoInfo = Who:WhoLookup(player)

                    if not IsAllowedGuild(WhoInfo.guild) then

                        return true

                    end

                else

                    return true

                end

            end

        end

    end

    Is there any way I can pause or wait for the callback to happen? I tried creating a variable WhoIsDone, setting it to true in the who callback function and then creating a loop waiting for it to be set to true, but it just went into an infinate loop and crashed wow lol

    I can paste the other functions if required.

    Any help appreciated.

    Unfortunately, no.  In order to do what you're asking, you would need to "pause" the entire client, waiting for the who request to return.  That's not really something you want to do =).  Unfortunately this is just a limitation of client/server communication.. You could possibly block the message outright.. and then if the who request says they are whitelisted then replay the message.. but that's not straightforward or precisely what you're looking for.

    Ahhhh damn, I was afraid there would be no straightforward solution, and after staying up until 6am this morning poking and prodding, I'd kind of given up on the "easy" way lol

    I atleast have an idea of how to replay the message, I was having a poke around in SpamMeNot (as you do), and noticed it outright blocks all whispers, adds them to a lookup queue and if they're ok, injects a fake whisper into the chatframe. Although, as you said, it doesn't look that easy lol.

    Luckily I wrote an unblock clickable link doodad thingie and for it to work, I store the last message received from a player and if the unblock link is clicked, it just prints it out so you don't have to get them to repeat what they said once you've temporarily whitelisted them.

    I'd prefer to keep the injection of whispers as simple as possible, and without creating a whole queue system, I can forsee an added bonus feature (bug). Seeing as I only store their last message in a table stored against their name, if they type very very fast, I could run the risk of "losing" messages, the bonus of this is it would act as built in spam protection :D And hey, I'm sure everything they say isn't really *that* important lol

    Oh well, I'll start writing the code and testing it, I'll post my solution here if/when I get it done incase it's helpful to anyone else.

    Ok, done some more digging and I've not got a clue how to inject a fake whisper lol

    I might shelf this feature, the only reference I can find is the method SpamMeNot uses, which is far from straightfoward, infact it's downright scary.

    yeah =)