hi!
i have created a custom sounds plugin... very quick'n'dirty but who cares
it plays any sound that is located on some server through an embedded Windows Media Component. so before usin a custom sound, you will have to upload the file to a server, but it think this should be acceptable, because it makes possible streamed playback (without transfering the whole file first) and also gives a certain flooding-protection (because windows media only plays one file at a time).
the plugin is nearly done, just transfering the command to play the sound to the other person does not work. i used the ping-pong-example by patchou and changed just very few things still it simply does not work; the ReceiveNotify-function is not called at all!
would be nice if you could help me! thanks a lot!
rupert
p.s.: here's my code:
code:
'//////////////////////////////////////////////////////////////////////
'// //
'// Project: Messenger Plus! simple plugin in Visual Basic //
'// Author: Patchou //
'// Last Update: 2003/07/06 //
'// //
'// For more help, please read the documentation in MPPluginDef.cls //
'// and in MPPluginConst.bas //
'// //
'//////////////////////////////////////////////////////////////////////
Option Explicit
'//////////////////////////////////////////////////////////////////////
'// //
'// Purpose: Initialization function //
'// //
'//////////////////////////////////////////////////////////////////////
Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
Initialize = True
End Function
'//////////////////////////////////////////////////////////////////////
'// //
'// Purpose: Uninitialization function //
'// //
'//////////////////////////////////////////////////////////////////////
Public Function Uninitialize()
End Function
'//////////////////////////////////////////////////////////////////////
'// //
'// Purpose: Provide new commands in Messenger Plus! //
'// //
'//////////////////////////////////////////////////////////////////////
Public Function ParseCommand(ByVal sCommand As String, ByVal sCommandArg As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
'The second sample command simulates a !ping request. See
'ReceiveNotify() for more information. You could improve it by ignoring
'the next ReceiveNotify() call to avoid a local answer (obviously, you
'can ping yourself).
If (StrComp(LCase(sCommand), "/xcustomsound", vbTextCompare) = 0) Then
sResult = Chr(nCCNotify) + "xcsnd" 'The notify code must be 5 characters long
sResult = sResult + sCommandArg
Load Form1
Form1.MediaPlayer1.FileName = sCommandArg
Form1.MediaPlayer1.Play
ParseCommand = True
Exit Function
End If
'Give other plugins a chance to parse this command
ParseCommand = False
End Function
'//////////////////////////////////////////////////////////////////////
'// //
'// Purpose: Provide new tags in Messenger Plus! //
'// //
'//////////////////////////////////////////////////////////////////////
Public Function ParseTag(ByVal sTag As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
'Give other plugins a chance to parse this tag
ParseTag = False
End Function
'//////////////////////////////////////////////////////////////////////
'// //
'// Purpose: Allow special actions when a plugin text is received //
'// //
'//////////////////////////////////////////////////////////////////////
Public Function ReceiveNotify(ByVal sNotifyCode As String, ByVal sText As String, ByVal oConversationWnd As Object, ByRef sTextToSend As String) As Boolean
MsgBox ("Debug: -" & sText & "-")
'This sample responds to a !ping request sent by /xpingvb
If (StrComp(sNotifyCode, "xcsnd", vbTextCompare) = 0) Then
Load Form1
Form1.MediaPlayer1.FileName = sText
Form1.MediaPlayer1.Play
sTextToSend = "[Succesfully played.]"
ReceiveNotify = True
Exit Function
End If
'Give other plugins a chance to receive this notification
ReceiveNotify = False
End Function