Handling "privMsg" internal event, missing user ob

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

hausmaus
Posts: 2
Joined: 03 Oct 2007, 03:31

Handling "privMsg" internal event, missing user ob

Postby hausmaus » 03 Oct 2007, 03:44

Hello all

Well I looked around for information about this on the forums and in the patch notes, please forgive me if I overlooked the answer.

I have a situation where I am not getting an evt.user object when handling the privMsg internal event (server 1.5.5). I have included "<my zone>.setPrivMsgInternalEvent(true);" in the code, likewise for public, and the handling of public messages works perfectly. But after a frustrating run of "cannot getValue() of undefined" from failed user variable requests on the private event, I traced evt.hasOwnProperty("user") and the reply is false, all indications are that no user object comes along with the event.

This is odd, because private messages sent without the internal event handler work fine, and the recipient definitely has the sender's user object to use for formatting.

The user is logged into multiple rooms, but they're rather vanilla. I have run into situations where disabling room event broadcasts cause server-side handling of user objects to fail, while they continue to work on the client side, and would suspect that this is similar except a) it works for public messages and b) I did eventually figure the other ones out, but this is driving me crazy. I may end up resorting to response objects for all messaging for bandwidth reasons anyway but I was hoping this would work.

Any thoughts?

Thank you,
-abm
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Oct 2007, 07:22

Could you provide a simple example or a step-by-step description that shows us how to reproduce the problem? It's not clear under which circumstances the problem is found.

Code: Select all

This is odd, because private messages sent without the internal event handler work fine, and the recipient definitely has the sender's user object to use for formatting.


This is also unclear, what do you mean? What does sending private message without event handler mean?

thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 08 Oct 2007, 09:37

Maybe he meant sending private message with setPrivMsgInternalEvent = false works and setting that to true does not?
kiruva
Posts: 4
Joined: 05 Oct 2006, 08:46
Location: Norway

Postby kiruva » 11 Oct 2007, 11:45

BUMP, or whatever..
Allthough the first post is a bit confusing, I seem to have similar problems.
Having set zone.setPrivMsgInternalEvent(true);.
The handleInternalEvent->privMsg works..
But e.user = undefined.

The following code:

Code: Select all

trace("=======================");
trace("=======privMsgInfo=========");
trace("---------------------------");
trace("sourceRoom: " + sourceRoom.getName());
trace("sender: " + e.user);
trace("recipient: " + recipient.getName());
trace("message: " + message);
trace("---------------------------");


Produces the following output:

Code: Select all

[extTextAPI.as]: =======================
[extTextAPI.as]: =======privMsgInfo=========
[extTextAPI.as]: ---------------------------
[extTextAPI.as]: sourceRoom: The Room
[extTextAPI.as]: sender: undefined
[extTextAPI.as]: recipient: bar
[extTextAPI.as]: message: foo2bar
[extTextAPI.as]: ---------------------------


The init code is correct and everything works fine with the pubMsg event.
So, what am I missing, or is it a cleverly disguised feature :P
Oh, using SmartFoxServer 1.5.9

Kind Regards
KiRuVa[/code]
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Oct 2007, 06:34

I think you should better check the documentation:
http://www.smartfoxserver.com/docs/docP ... ivMsg.html

There are two properties called sender and recipient, but there's no user property.
Lapo

--

gotoAndPlay()

...addicted to flash games
kiruva
Posts: 4
Joined: 05 Oct 2006, 08:46
Location: Norway

Postby kiruva » 12 Oct 2007, 11:06

Edit: Deleted...

Right you are.. :P
My Bad..

Best Regards
KiRuVa
ransaymour
Posts: 27
Joined: 20 Jun 2016, 18:30

Re: Handling "privMsg" internal event, missing user ob

Postby ransaymour » 27 Jan 2018, 20:52

Someone got confused writing the instructions so that's why you made a mistake :?


Image

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 52 guests