aMSN Forums
May 25, 2013, 09:59:17 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: plugin chat_msg_receive issue  (Read 3040 times)
cii
Newbie

Offline Offline

Posts: 26


View Profile
« on: November 14, 2006, 04:34:04 pm »

I had a question about the chat_msg_receive proc while adding some personal features to the music plugin.  
I have a new event registered as
Code:
::plugins::RegisterEvent "Music" chat_msg_receive msg_received_1
.  As I understand, this proc should only be called when I receive a message from another user.  But amsn also calls it when I send a message to someone else.  Is this normal? or am I doing something completely stupid?  I can't really tell because I'm a complete noob and modifying the plugin by reading the wiki and the other plugins.
Any help will be greatly appreciated.
Thanks
Logged
JeeBee
Power user
*
Offline Offline

Posts: 139


View Profile
« Reply #1 on: November 14, 2006, 04:52:56 pm »

No, it's normal.
The easiest way for you to deal with this is just to check who sends the message at the beginning of your msg_received_1 proc.
It could look like this:

Code:

proc msg_received_1 {event epvar} {
  upvar 2 $epvar args
  upvar 2 $args(msg) msg
  upvar 2 $args(chatid) chatid
  upvar 2 $args(user) user

  if {$user == [::abook::getPersonal login]} {
    # Hey, that's me!
    return
  }

  # Rest of your code
}
Logged
cii
Newbie

Offline Offline

Posts: 26


View Profile
« Reply #2 on: November 14, 2006, 11:26:13 pm »

You're AWESOME! It worked beautifully.  Thankyou
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!