Client::sendMessage from WinUtil::CheckCommand

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
Gratch06
Posts: 141
Joined: 2003-05-25 01:48
Location: USA

Client::sendMessage from WinUtil::CheckCommand

Post by Gratch06 » 2003-07-01 23:07

I want to send a message to the server when I go /away....this occurs in WinUtil::CheckCommand. The way that I've seen to send messages to the server from the client is using the sendMessage member of the Client class. I've spent some time trying different methods of doing this, with lessening degrees of success. Is there another way to send a message to the server from WinUtil::CheckCommand? or what must I do to use the Client::sendMessage from there? Thanks for the help.

- Gratch06

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-07-02 06:52

You need to check for the /away command in HubFrame.cpp, in the onLine() method. Here you have access to a Client object. Unfortunately, you do not have access to a Client object in the WinUtil::checkCommand() method, so it is not possible to do what you want there.

Sarf
---
Never attribute to malice what can be adequately explained by stupidity.

Gratch06
Posts: 141
Joined: 2003-05-25 01:48
Location: USA

Post by Gratch06 » 2003-07-06 01:13

After adding the command to HubFrame::onEnter (onLine serves to receive messages from the server methinks...but whatever) I can do a check for /away there. The difficulty comes in that it checks commands first, and if it finds a match (as it does using WinUtil::checkCommand() ), it will exit the command checker structure (and why not? we hit our command...what more is there?). My bad workaround right now is to tack it on at the end, so that it happens regardless of whether or not a prior command has been hit, or a message has been sent, or anything like that (one more check on every line that starts with a /) This isn't the best way, but the whole duplicate commands thing is killing me.

-Gratch06

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-07-06 06:32

Oops. Sorry about the onLine() method reference - my mistake!

The problem is that the checkCommands() method is called both by the PrivateFrame and HubFrame, and it is not meant to actually *do* anything server-side, so there were no need to add the Client* to it. You could, however, tack on a Client* parameter and make the HubFrame and the PrivateFrame send their Client* to it.

Sarf
---
"As far as I'm concerned, nitrous use is quite like being a Jedi knight. You're not doing it properly until you've made your own bulbulator." - Daniel Rutter

Locked