Back to product page
- Introduction
- License agreement
- Getting Started
- Enumerations
- Objects
- wodXMPP
- Methods
- Properties
- Authentication
- AutoVisible
- BackColor
- Blocking
- BorderVisible
- Capabilities
- ChatRooms
- CombineResources
- Contacts
- Enabled
- Features
- Files
- FillColor
- Font
- ForeColor
- Identity
- Language
- LastError
- LastErrorText
- Login
- Notification
- Password
- Picture
- Port
- Priority
- ProxyHostname
- ProxyLogin
- ProxyPassword
- ProxyPort
- ProxyType
- Register
- Resource
- RowHeight
- SecureMethod
- Security
- Services
- ServicesFiltered
- ShowMyself
- SmallFont
- State
- StateText
- Status
- StatusText
- TabStop
- Timeout
- UseUPnP
- VCard
- Version
- Events
- ChatRoomData
- ChatRoomInvite
- ChatRoomListDone
- Click
- Connected
- ContactAuthRequest
- ContactList
- ContactSearchDone
- ContactStatusChange
- DblClick
- Disconnected
- Error
- FileTransferEnd
- FileTransferProgress
- FileTransferStart
- HostCertificate
- IncomingMessage
- IncomingNotification
- Pong
- PreTranslateCommand
- PreTranslateReply
- PrivateData
- ServiceRegister
- ServiceStatusChange
- StateChange
- UnhandledIQ
- VCardDetails
- IwodXMPPNotify
- Methods
- ChatRoomData
- ChatRoomInvite
- ChatRoomListDone
- Connected
- ContactAuthRequest
- ContactList
- ContactSearchDone
- ContactStatusChange
- Disconnected
- Error
- FileTransferEnd
- FileTransferProgress
- FileTransferStart
- HostCertificate
- IncomingMessage
- IncomingNotification
- Pong
- PreTranslateCommand
- PreTranslateReply
- PrivateData
- ServiceRegister
- ServiceStatusChange
- StateChange
- UnhandledIQ
- VCardDetails
- Methods
- XMPPChatRoom
- XMPPChatRooms
- XMPPContact
- XMPPContacts
- XMPPFeature
- XMPPFeatures
- XMPPFile
- XMPPFiles
- XMPPIdentities
- XMPPIdentity
- XMPPMessage
- XMPPService
- XMPPServices
- XMPPTag
- XMPPTags
- XMPPVar
- XMPPVars
- XMPPVCard
- Methods
- Properties
- BirthDay
- Description
- FirstName
- FullName
- HomeAddress
- HomeAddressExt
- HomeCellPhone
- HomeCity
- HomeCountry
- HomeFax
- HomePhone
- HomeState
- HomeZip
- JID
- LastName
- MiddleName
- NickName
- OrganizationName
- OrganizationUnit
- Photo
- PhotoData
- PhotoURL
- Role
- Title
- URL
- WorkAddress
- WorkAddressExt
- WorkCellPhone
- WorkCity
- WorkCountry
- WorkFax
- WorkPhone
- WorkState
- WorkZip
- wodXMPP
- How to get support?
- Technical information
- Fast notifications interface
- Error list
Search method
Searches for contacts.
Syntax
- Basic
object.Search (Service, Query)
The Search(object,Service,Query) syntax has these parts:
The Search(object,Service,Query) syntax has these parts:
object | An expression evaluating to an object of type XMPPContacts |
Service | XMPPService object. Specifies which service (of type CatDirectory) to use to perform the search. |
Query | XMPPVars value. Contains search query, as required by the server. Can be set to NULL (Nothing in VB). |
Remarks
Search method will send request to the server to perform various searches, usually to search for contacts that exist on the server. When search completes, ContactSearchDone event will fire with the results.In order to obtain required service to perform the search, you should check Services of CatDirectory identity. You can also use ServicesFiltered (CatDirectory) to obtain the list the easier way. Once you choose the service, you can perform complete search in two steps:
- First step is to call Search method with Query argument set to NULL (Nothing in VB), so that server provides us with the "Search Form" which can be filled by the user, something like this:
Dim DirService As XMPPService
Set DirService = wodXMPP1.ServicesFiltered(CatDirectory).Item(0) 'first one available
wodXMPP1.Contacts.Search DirService, Nothing
- When above code completes, ContactSearchDone event fires containing the "Search Form" which can be shown on the screen. To be sure server provided the form, you can check XMPPVars.Type property which should contain 'VarForm' value. User then enters search details, and you perform the search again, but this time Query will contain values entered by the user:
Private Sub wodXMPP1_ContactSearchDone(ByVal Service As WODXMPPCOMLib.IXMPPService, ByVal Items As WODXMPPCOMLib.IXMPPVars)
If Items.Type = VarForm Then
Dim fok As Boolean
fok = Items.Show("") ' user clicked on OK?
If fok Then wodXMPP1.Contacts.Search Service, Items ' real search, with the data
End If
End Sub
- When real search completes, ContactSearchDone event fires again, containing search results. Since data is received as multiple-rows data (tabular), wodXMPP will create XMPPVars collection again, but each Item will contain "subitems" too - one such item for each row. Data will be returned as VarReport in XMPPVars.Type. For example, you can then view search results like this:
Private Sub wodXMPP1_ContactSearchDone(ByVal Service As WODXMPPCOMLib.IXMPPService, ByVal Items As WODXMPPCOMLib.IXMPPVars)
If Items.Type = VarReport Then
Dim i As Integer
For i = 0 To Items("jid").SubCount - 1
Debug.Print Items("jid").SubValue(i) ' show only JID subitems
Next i
End If
End Sub
Dim DirService As XMPPService
Set DirService = wodXMPP1.ServicesFiltered(CatDirectory).Item(0) 'first one available
Dim Query As New XMPPVars
Query.Add("jid").Value = "myfriend*"
wodXMPP1.Contacts.Search DirService, Query