Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Setting can_send_commands flag in chat plugin from an alias

Setting can_send_commands flag in chat plugin from an alias

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Bobble   Canada  (76 posts)  Bio
Date Tue 27 Jan 2004 04:26 AM (UTC)

Amended on Fri 09 Jul 2004 06:54 PM (UTC) by Bobble

Message
Greets all,

I've encountered what I believe to be a small problem, but I can't seem to figure out how to solve it.

I'm just starting to use the chat plugin. I've created an alias in MUSHCLIENT (not by modifying the chat plugin itself) to turn on certain chat options, here it is:
<aliases>
  <alias
   match="chaton"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>SetAlphaOption &quot;chat_name&quot;, &quot;Bobble&quot;
SetOption &quot;accept_chat_connections&quot;, 1
chatcall &quot;1.1.1.1&quot;, 4050
SetChatOption (ChatGetID (&quot;Bill&quot;)), &quot;can_send_commands&quot;, 1</send>
  </alias>
</aliases>


Everything is working fine except for the very last option. I want this alias to set it up so that I accept commands (sent via the #command function) from Uvatha. What I've got here doesn't generate any errors, but it doesn't make it so that uvatha can send me any commands either. I get the "Bill attempted to send you a command." message.

All I'm looking for is a way to create an alias that sets it so that I can accept commands from Bill. What have I done wrong?

Also, RE the chat client, what exactly is in a Long ID. For instance if, instead of using getchatID, I just wanted to enter the ID manually, what info would I have to give it and what would it look like (by this I mean would it have brackets, quotes, etc around it.)

Thanks all

Open the watch.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 27 Jan 2004 08:24 PM (UTC)

Amended on Tue 27 Jan 2004 08:26 PM (UTC) by Nick Gammon

Message
OK, I think I see. First I'll get rid of the &quot; things from your post, which are not really needed, although I know the XML writer generates them ...




SetAlphaOption "chat_name", "Lessik"
SetOption "accept_chat_connections", 1
chatcall "1.1.1.1", 4050
SetChatOption (ChatGetID ("Uvatha")), "can_send_commands", 1



So I gather what you are doing is calling someone on an address (1.1.1.1 in your example, although I presume that is not really it), and a moment later you are letting Uvatha send you commands.

However the documentation for "chatcall" states this:




Because of the asynchronous nature of TCP/IP a "good" status from this call does not necessarily mean you will establish a chat session, it just means it has succeeded in starting the process.

In order to establish a chat session, MUSHclient must:


  1. Look up the name using the Domain Name Server (DNS) unless a dotted-decimal name was given - this may take a few seconds.
  2. Connect to the chat server - this may take a few more seconds
  3. Attempt to negotiate a chat session by sending "CHAT:" to the chat server
  4. Await a response - this may take a while if the player at the other end is deciding whether to accept the connection or not.
  5. Finally, if all goes well, the chat session is established.



To know if the session was really established you need to use the plugin callback routine "OnPluginChatNewUser" - this notifies you when a new user is established.




The point here is that you are setting Uvatha as "can send commands" too soon, the connection would not yet be made.

What you need to do is add a "chat callback" to either the standard chat plugin, or make your own little plugin which has something like this in it:




sub OnPluginChatNewUser (id, name)

  Note "New chat user: " & name

  if LCase (name) = "uvatha" then
     SetChatOption id, "can_send_commands", 1
  end if

end sub




The standard chat plugin has a template for doing the above which is very similar to what I posted there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,874 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.