matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Toasts on receivers pc
I was having the same problem with my Remote Shutdown Plugin I was designing, the only work around I had was sending the UserEmail (recieved at Initialization) with the message and compare it to the one on the computer if its the same dont do anything but if its different then display the toast. Whats happening is when you type in the command the plugin on your computer gets the RecieveNotify code to because its in the convo window.
code: Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
Initialize = True
strUserEmail = sUserEmail
End Function
code: sResult = Chr(nCCNotify) + "showm" + "Display Toast " + vbCrLf + "Text: " + sCommandArg + vbCrLf + "Email: " + strUserEmail
code: 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, "showm", vbTextCompare) = 0) Then
Dim sptRecievedText() As String
strSplit sText, sptRecievedText(), Chr(13)
sptRecievedText(1) = Replace(sptRecievedText(1), "Text: ", "")
sptRecievedText(2) = Replace(sptRecievedText(2), "Email: ", "")
If sptRecievedText(2) = strUserEmail Then
ReceiveNotify = False
Exit Function
Else
DisplayToast sptRecievedText(2), "myplugin", "", True
ReceiveNotify = True
Exit Function
End If
End If
ReceiveNotify = False
End Function
Here is a good Split Function I found on PSC (Put This Into A Module
code: Public strUserEmail As String
Public Function strSplit(ByVal Sin As String, sOut() As String, Optional sDelim As String, Optional nLimit As Long = -1, Optional bCompare As VbCompareMethod = vbBinaryCompare) As Variant
Dim sRead As String
If sDelim = "" Then sDelim = " "
If InStr(Sin, sDelim) = 0 Then
ReDim sOut(0) As String
sOut(0) = Sin
strSplit = sOut
Exit Function
End If
sRead = ReadUntil(Sin, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit <> -1 And nC >= nLimit Then Exit Do
sRead = ReadUntil(Sin, sDelim)
Loop While sRead <> "~TWA"
ReDim Preserve sOut(nC)
sOut(nC) = Sin
strSplit = sOut
End Function
Public Function ReadUntil(ByRef Sin As String, sDelim As String, Optional bCompare As VbCompareMethod = vbBinaryCompare) As String
Dim nPos As Long
nPos = InStr(1, Sin, sDelim, bCompare)
If nPos > 0 Then
ReadUntil = Left(Sin, nPos - 1)
Sin = Mid(Sin, nPos + Len(sDelim))
Else
ReadUntil = "~TWA"
End If
End Function
|
|