Shoutbox

vb6 server plug in - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: vb6 server plug in (/showthread.php?tid=58065)

vb6 server plug in by mix on 04-09-2006 at 03:35 PM

i'm writing a plug-in for my server.
i wont that plug in response which my ip addres at the "!xip" comand.

i've do the code for the ip but i don't know where i must put it.

this is the code:

code:
Option Explicit

Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
    Initialize = True
End Function

Public Function Uninitialize()
End Function
Public Function GetPublishInfo(ByRef sPluginName As String, ByRef nCommandCount As Long, ByRef nTagCount As Long) As Boolean
    sPluginName = "Server Function"
    nCommandCount = 1
    nTagCount = 0
   
    GetPublishInfo = True
End Function

Public Function GetPublishCommandInfo(ByVal nCommandIdx As Long, ByRef sName As String, ByRef sValue As String, ByRef sHelp As String)
    If (nCommandIdx = 1) Then
        sName = "Invia l'ip del server"
        sValue = "xip"
    End If
End Function

Public Function GetPublishTagInfo(ByVal nTagIdx As Long, ByRef sName As String, ByRef sValue As String)

End Function
Public Function ParseCommand(ByVal sCommand As String, ByVal sCommandArg As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
    If (StrComp(LCase(sCommand), "/xip", vbTextCompare) = 0) Then
        'Display a message including the given parameter
        Dim o As Object
        Dim xip As String
        Set o = CreateObject("InetCtls.Inet")
        xip = o.OpenURL("http://bot.my-board.net/ip.php")
        Set o = Nothing
       
        'Send back an empty string to cancel the message
        sResult = "Il tuo ip è:" + xip
        ParseCommand = True
        Exit Function
    End If
    ParseCommand = False
End Function


Public Function ParseTag(ByVal sTag As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
    ParseTag = False
End Function

Public Function ReceiveNotify(ByVal sNotifyCode As String, ByVal sText As String, ByVal sContactName As String, ByVal oConversationWnd As Object, ByRef sTextToSend As String) As Boolean

    If (StrComp(sNotifyCode, "xip", vbTextCompare) = 0) Then
       
        Dim o As Object
Dim xip As String

Set o = CreateObject("InetCtls.Inet")
xip = o.OpenURL("http://bot.my-board.net/ip.php")
Set o = Nothing
        sTextToSend = "Il tuo ip è:" + xip
        ReceiveNotify = True
        Exit Function
    End If
   

    ReceiveNotify = False
End Function

anyone can help me?

(i've put it in ReceiveNotify but it didn't go)
RE: vb6 server plug in by matty on 04-09-2006 at 10:12 PM

The sNotifycode HAS to be 5 characters long it describes the functions in great detail in another module.

Also you cannot have a plugin respond to a (!XIP) tag it can only respond to a /xip command.

You need to read the documentation provided in a module on the receivenotify.

code:
'  //////////////////////////////////////////////////////////////////////
'  //
'  // Purpose: Allow special actions when a plugin text is received
'  //
'  // Definition:
'  //   This function is called everytime Messenger Plus! detects a
'  //   plugin text ID in a message received from a user. This ID is
'  //     generally placed at the beginning of a text by a plugin
'  //     command to perform an action on the destination computers.
'  //     This can be used, for example, to play a sound. See the
'  //     control characters section for more information.
'  //
'  // Parameters:
'  //     * sNotifyCode: this 5 character string is the notify code that
'  //       was sent next to the plugin ID control character. Use it to
'  //       identify what action to perform.
'  //     * sText: the rest of the received message. You can use it to
'  //       get more information about the action you want to perform.
'  //       However, you MUST NOT use this parameter to determine if an
'  //       action is supported by your plugin. Use sNotifyCode instead.
'  //     * pParam: additional information sent by Messenger Plus!. For
'  //       more information, read the documentation of the PLUGIN_PARAM
'  //       structure. iConversationWnd and sContactName are used.
'  //     * sTextToSend: this parameter is optional. You can use it if
'  //       you want to ask Messenger Plus! to send a new message after
'  //       this one has been displayed. This WON'T modify the message
'  //       associated with the notify code, this will simply send a new
'  //       one. Important: the size of this buffer is 2048 characters
'  //       and it is YOUR responsability to verify that you don't write
'  //       more characters to avoid memory faults. In any case, no more
'  //       than 1100 characters will be sent on the network.
'  //     * return value: if you recognized the notify code return TRUE,
'  //       else, return FALSE.
'  //
'  // Important: keep in mind that several plugins can be installed
'  // and that a lot of text is received. If you don't support the
'  // notify code passed in parameter, you must return as fast as
'  // possible and without doing anything else.
'  //
'  //////////////////////////////////////////////////////////////////////




This will respond to the (!XIP) tag.

You can actually change this around somewhat.

code:
Public xip As String

Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
    Initialize = True

    Dim o As Object
    Set o = CreateObject("InetCtls.Inet")
    xip = o.OpenURL("http://bot.my-board.net/ip.php")
    Set o = Nothing
End Function

Public Function ParseTag(ByVal sTag As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
    ParseTag = False
   
    If InStr(1,LCase(sTag), "xip) Then
        sResult = "Il tuo ip è:" + xip
    End If
End Function

RE: vb6 server plug in by mix on 04-10-2006 at 07:46 PM

but if i use ParseTag, it don't analyse the external tag, i won't it


RE: vb6 server plug in by matty on 04-10-2006 at 08:37 PM

Ok then I am not exactly sure what you are wanting to do. Do you want to send the /xip command and have it respond and give you the contacts IP address?

Your going to need to explain a bit more of what exactly your wanting to do.


RE: vb6 server plug in by mix on 04-10-2006 at 08:56 PM

no, i won't to send from my msn the /xip comand, and the msn server send me its ip.


RE: vb6 server plug in by matty on 04-10-2006 at 09:09 PM

You cannot request the MSN Server ip address. The plugin infastructure works so that both parties require the plugin itself to be installed locally.

If you want to get the IP address of the connected server goto Start > Run > cmd > netstat -n

That will show you all current connections and their port numbers being used.


RE: vb6 server plug in by mix on 04-11-2006 at 08:20 PM

for the ip of the server i've do a method, it isn't my problem, my problem is manage the receved tag form an other messanger to my server.