Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Listening for General Chat / Instant messages inside modified client

Entheogen Aeon
boing boom tschak
Join date: 25 Dec 2007
Posts: 34
01-29-2009 17:22
Hello. This is not an LSL quesiton, but about modifying the client's C++ Code. I am trying to figure out how to create and register a callback for receiving chat message events, or receiving an instant message.

I did not find a forum dedicated to modified client on this webpage, so I put it into this forum.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-29-2009 19:31
From: Entheogen Aeon
Hello. This is not an LSL quesiton, but about modifying the client's C++ Code. I am trying to figure out how to create and register a callback for receiving chat message events, or receiving an instant message.

I did not find a forum dedicated to modified client on this webpage, so I put it into this forum.

Best place to query would be the sldev mailing list:

https://lists.secondlife.com/cgi-bin/mailman/listinfo/sldev
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-30-2009 08:58
I've done this for a name-to-key mapping. I'll post the patch in a moment. It was created in the 1.21 branch, but my patch utility can still find the right places to apply the changes, and examining the changes should give you an idea of how it was done as well.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-30-2009 09:21
Here you go. Some notes on it:

1.) This was only meant to be a little temporary test patch thing (though I have gotten some use out of it). I didn't go by the LL naming conventions on class names or local variables or anything. Also, some places I use "HZ" and some places I use "MH". Shouldn't be too confusing, but I'm not explaining the history. :p

2.) The idea is that it listens in local chat and the IM window for someone (I'd have to look at it again to see if it accepts object chat; I THINK it did) to say "getkey avatarName" and responds via a whisper or an IM, respectively. You can issue the command yourself, at least in chat (can't remember if it works for YOU in the IM window; probably not).

3.) The patch file would be applied by going to the root SVN checkout directory and using the POSIX patch utility like: "patch -p 1 <pathToPatchFile". If you're in Windows or something, get cygwin or whatever. Or apply it by hand, which shouldn't be too hard from looking at the contents of the patch file.

Oh yeah. Author hereby grants permission for you (anyone) to use it however you wish, but by doing so you accept full liability for any damages or hurt feelings that may arise, etc. Note that if you use it in conjunction with the SecondLife product or source code, you must also honor Linden Lab's licences and terms. Use, modify, or redistribute in any fashion. Credit to the author would be appreciated, but is not required.
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
01-30-2009 13:38
This is from very old code (1.18) but maybe it' still relevant...

llviewermessage.cpp has two functions of interest to intercepting text chat:

process_chat_from_simulator
process_improved_im

I added one line to each to pass me the message and the is_owned_by_me flag.
_____________________
The Vengeance Studio Gadget Store is closed!

Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-30-2009 14:07
From: Anya Ristow
This is from very old code (1.18) but maybe it' still relevant...

llviewermessage.cpp has two functions of interest to intercepting text chat:

process_chat_from_simulator
process_improved_im

I added one line to each to pass me the message and the is_owned_by_me flag.


That's pretty much what my code does if you look at it (first file in the patch), though I compared to a regex right there instead of generalizing that part. It could easily be turned into a general registry of chat processors. Chain of Responsibility or some such pattern.
Entheogen Aeon
boing boom tschak
Join date: 25 Dec 2007
Posts: 34
01-30-2009 14:37
thanks for replies, guys. yea i ended up modifying stuff in llviewermessage.cpp file.