JoinChannel Method
Objects

JoinChannel Method

Description

Allows the user to join an existing channel or create a new channel.

Syntax

object.JoinChannel [ChannelName][, ChannelKeyword]

PartDescription
object Required. An object expression that evaluates to a Channel object.
ChannelName Optional. A variant that contains the Name of the channel. If specified, the ChannelName variant must be empty or a string that is a valid channel Name. If the parameter is empty or not specified, the current value of the ChannelName property is used instead.
ChannelKeyword Optional. A variant. If specified, this variant must be empty or a string. If the parameter is empty or not specified, the control tries to join the channel without using a Keyword.

Remarks

The channel state must be chsClosed for the call to succeed, and the channel must belong to the collection for the call to be successful.

A JoinChannel call results in the same kind of events as a CreateChannel call.

At creation time, the state of the created channel is chsClosed. Then, when calling its JoinChannel or CreateChannel method, the state becomes asynchronously chsOpening and chsOpen. It becomes chsClosed again when the user leaves the channel or is kicked from the channel, or when a server disconnection occurs.

Example

'Specifies the ChannelName and ChannelKeyword
MsChatPr1.Channels(lIndex).JoinChannel "#MyRoom", "SecretPassword"

'Specifies only the ChannelName
MsChatPr1.Channels(lIndex).JoinChannel "#MyRoom"

See Also

ChannelName, ChannelState, enumChannelState, OnChannelState, OpeningChannels


KickMember Method

Description

Kicks a member from the channel.

Syntax

object.KickMember MemberNickname[, Reason]

PartDescription
object Required. An object expression that evaluates to a Channel object.
MemberNickname Required. A string expression that must be a valid member nickname from the channel.
Reason Optional. A string expression containing the reason for kicking the user from the channel.

Example

MsChatPr1.Channels(2).KickMember "WadeR", "Bad behavior!"

chan11.KickMember "WadeR"

See Also

Nickname, OnMemberKicked


LeaveChannel Method

Description

Closes the current channel.

Syntax

object.LeaveChannel

PartDescription
object Required. An object expression that evaluates to a Channel object.

Remarks

The channel state must be chsOpen for the call to be successful.

Leaving a channel does not remove it from the Channels collection. The user can reuse the same Channel object to join and leave several channels sequentially.

A successful LeaveChannel call results in an OnChannelState event.

Example

MsChatPr1.Channels(iIndex).LeaveChannel

See Also

JoinChannel


ListMembers Method

Description

Lists the members of the channel.

Syntax

object.ListMembers MemberQueryItems

PartDescription
object Required. An object expression that evaluates to a Channel object.
MemberQueryItems Required. An object expression that evaluates to a ChatItems object.

The MemberQueryItems parameter is currently unused. It is present for backward compatibility in the future.

Remarks

Future releases of the protocol might include some method of narrowing the member listing. In this case the MemberQueryItems parameter would come into use. Currently neither the IRC nor the IRCX protocols offer any member-listing criteria.

Example

Dim mqi As ChatItems
chan.ListMembers mqi

See Also

OnMemberProperty, QueryMemberProperty


QueryChannelProperty Method

Description

Asynchronously accesses a channel property.

Syntax

object.QueryChannelProperty ChannelPropertyName

PartDescription
object Required. An object expression that evaluates to a Channel object.
ChannelPropertyName Required. A string that contains one of the valid values shown in the following table.
IRCX IRC/IRCX
protocol only    protocols
Account BannedList
ClientData Keyword
ClientGuid MaxMemberCount
CloneList MemberCount
CreationTime   Modes
HostKey Name
Lag Topic
Language
ObjectId
OnJoin
OnPart
OwnerKey
Rating
ServicePath
Subject

Remarks

A successful QueryChannelProperty call results in an OnChannelProperty event where the ChannelItems parameter exposes all the known channel properties.

Examples

chan.QueryChannelProperty "Account"

chan.QueryChannelProperty "MaxMemberCount"

See Also

ChannelName, ListChannels, MemberCount


QueryMemberProperty Method

Description

Asynchronously requests a member property.

Syntax

object.QueryMemberProperty MemberPropertyName[, MemberNickname]

PartDescription
object Required. An object expression that evaluates to a Channel object.
MemberPropertyName Required. A string containing one of the following valid member property name values.
Identity
IPAddress
Modes
Nickname
ObjectId (IRCX protocol only)
UserName
MemberNickname Optional. A string expression. If specified, this parameter must be an empty variant or a valid channel member nickname. If omitted or empty, the nickname of the caller is used.

Remarks

A successful call results in an OnMemberProperty event where the MemberItems parameter exposes all the known member properties.

Examples

MsChatPr1.Channels.Item(3).QueryMemberProperty "Identity", "DerrickL"

MsChatPr1.Channels.Item(3).QueryMemberProperty "Modes"

See Also

enumMemberMode, MemberIdentity, MemberProperty


SendInvitation Method

Description

Invites a user to the channel.

Syntax

object.SendInvitation Nickname

PartDescription
object Required. An object expression that evaluates to a Channel object.
Nickname Required. A string expression that contains the invited user's Nickname.

Remarks

The invited user gets an OnInvitation event.

Example

MsChatPr1.Channels(5).SendInvitation "EuniceM"

The previous example is equivalent to:

MsChatPr1.SendInvitation("EuniceM",MsChatPr1.Channels(5).ChannelName)


SendMessage Method

Description

Sends text or data messages to the channel or members of the channel.

Syntax

object.SendMessage MessageType, Message[, RecipientNicknames][, DataMessageTag]

PartDescription
object Required. An object expression that evaluates to a Channel object.
MessageType Required. A long integer that is a combination of some of the enumMessageType enumeration values. The valid MessageType values are:
msgtNormal
msgtNotice
msgtData
msgtDataRequest
msgtDataReply
msgtWhisper
msgtData + msgtDataRaw
msgtDataRequest + msgtDataRaw
msgtAction + msgtNormal
msgtSound + msgtNormal
msgtCTCP + msgtNormal
msgtAction + msgtNotice
msgtSound + msgtNotice
msgtCTCP + msgtNotice
msgtAction + msgtWhisper
msgtSound + msgtWhisper
msgtCTCP + msgtWhisper

The msgtNotice, msgtData, msgtDataRequest, msgtDataReply, and msgtWhisper values are mutually exclusive.

The msgtData, msgtDataRequest, msgtDataReply, msgtAction, msgtSound, and msgtCTCP values are mutually exclusive.

The msgtDataRaw, msgtAction, msgtSound, and msgtCTCP values are mutually exclusive.

Message Required. A variant containing the actual message to send. It can be a string, a number, an array of strings, an array of numbers, or an array of variants that can be strings and numbers. The variant types allowed for those numbers are:
VT_UI1
VT_I2
VT_I4
VT_R4
VT_R8
VT_BOOL
VT_ERROR
VT_CY
VT_DATE

When sending data and the msgtDataRaw flag is not set, the control packages the Message variant into an array of bytes. An internal header is used to notify the recipient(s) that the message originates from an MsChatPr control.

When the msgtDataRaw flag is also set, the Message variant can only be a postprocessed string, a byte, an array of bytes, or an array of variants that are bytes.

A postprocessed string is a string that was modified using the regular conversion scheme, as shown in the following table.
Character    Becomes string
'\0' "\0"
'\' "\\"
'\n' "\n"
'\r' "\r"
'\t' "\t"
' ' "\b"
',' "\c"

When sending raw data, the control simply converts the Message parameter into a postprocessed string without using an internal header. This way all clients can handle the data message.

RecipientNicknames Optional. A variant. Can be missing, an empty variant, or an empty string to send the message to the channel. Otherwise it can be a string, an array of strings, or an array of variants that are strings to send the message to designated channel members.

On IRC servers, there is no method to send a message to specific channel members, so the RecipientNicknames parameter must always be empty or missing.

On IRCX servers, the RecipientNicknames parameter can always specify one or more recipients, or it can be empty.

When msgtWhisper is used, the parameter must specify one or more recipients. The recipient list is exposed to the recipients only when using the msgtWhisper type.

DataMessageTag Optional. A variant. For IRCX servers only. This parameter is used only when sending data (that is, the msgtData, msgtDataRequest, or msgtDataReply flag is set). If sending data, this parameter must be a non-empty string. In all other cases, this parameter must be empty or missing.

Examples

1. Send a regular string to the channel:

MsChatPr1.Channels(4).SendMessage msgtNormal, "Hi there!"

2. Send a notice to the channel:

chan3.SendMessage msgtNotice, "Bye now!"

3. Send an action to the channel (CTCP action):

chanobj.SendMessage msgtAction, "is eating couscous...."

4. Send a sound to the channel (CTCP sound):

MsChatPr1.Channels.Item(2).SendMessage msgtSound, "couscous.wav Isn't that cool?"

5. Send a CTCP message to the channel:

MsChatPr1.Channels(3).SendMessage msgtCTCP, "FINGER"

6. Send text to a channel member:

chanobj.SendMessage msgtNormal, "I'm an alien spy, and U?", "SharonL"

7. Send a notice to several channel members:

Dim strRecipients(1 To 3) As String

strRecipients(1) = "ColeenS"
strRecipients(2) = "DerrickL"
strRecipients(3) = "EuniceM"
chanobj.SendMessage msgtNotice, "I'm a spy, too...", strRecipients
'or
Dim vRecipients(1 To 3) As Variant

vRecipients(1) = "ColeenS"
vRecipients(2) = "DerrickL"
vRecipients(3) = "EuniceM"
chanobj.SendMessage msgtNotice, "I'm a spy, too...", vRecipients

8. Send an action to several channel members:

Dim strRecipients(1 To 3) As String

strRecipients(1) = "ColeenS"
strRecipients(2) = "DerrickL"
strRecipients(3) = "EuniceM"
chanobj.SendMessage msgtAction, "is eating macaroni and cheese....", strRecipients
'or
Dim vRecipients(1 To 3) As Variant

vRecipients(1) = "ColeenS"
vRecipients(2) = "DerrickL"
vRecipients(3) = "EuniceM"
chanobj.SendMessage msgtAction, "is eating macaroni and cheese....", vRecipients

9. Whisper text to a channel member:

chanobj.SendMessage msgtWhisper, "I'm an alien spy, and U?", "SharonL"

10. Whisper text to channel members:

Dim strRecipients(1 To 3) As String

strRecipients(1) = "SteveL"
strRecipients(2) = "WadeR"
strRecipients(3) = "Eldon"
chanobj.SendMessage msgtWhisper, "I'm a spy, too...", strRecipients
'or
Dim vRecipients(1 To 3) As Variant

vRecipients(1) = "Charlotte"
vRecipients(2) = "Zorg"
vRecipients(3) = "Arthur"
chanobj.SendMessage msgtWhisper, "I'm a cook, too...", vRecipients

11. Send a string as data to the channel:

chanobj.SendMessage msgtData, "And a painter as well.", , "_FOO_"

12. Send a number to channel members:

Dim vRecipients(1 To 3) As Variant

vRecipients(1) = "Charlotte"
vRecipients(2) = "Zorg"
vRecipients(3) = "Arthur"
chanobj.SendMessage msgtData, 1156, vRecipients, "X"

13. Send an array of numbers to the channel:

Dim iValues(1 To 4) As Integer

iValues(1) = 10
iValues(2) = -22
iValues(3) = 123
iValues(4) = 0

chanobj.SendMessage msgtData, iValues, , "COORD"
'or 
Dim vValues(1 To 4) As Variant

vValues(1) = 10
vValues(2) = -22
vValues(3) = 123
vValues(4) = 0

chanobj.SendMessage msgtData, vValues, , "COORD"

14. Send an array of strings to a channel member:

Dim strValues(1 To 4) As String

strValues(1) = "Blue"
strValues(2) = "Green"
strValues(3) = "Red"
strValues(4) = "White"

chanobj.SendMessage msgtData, strValues, "Arthur", "COLORS"
'or 
Dim vValues(1 To 4) As Variant

vValues(1) = "Blue"
vValues(2) = "Green"
vValues(3) = "Red"
vValues(4) = "White"

chanobj.SendMessage msgtData, vValues, "Arthur", "COLORS"

15. Send an array of variants to the channel:

Dim vValues(5 To 10) As Variant

vVariant(5) = Now
vVariant(6) = "Your turn to play...."
vVariant(7) = -10
vVariant(8) = 5
vVariant(9) = -12.689
vVariant(10) = 9876582146

chanobj.SendMessage msgtData, vValues, , "TheHugeOne"

16. Send raw data to the channel:

'A postprocessed string

chanobj.SendMessage msgtData+msgtDataRaw,_
      "dhe\rotk\\nsk\0k45v\0zxa\\v", , "ProcessedString"

'One byte

Dim byt As Byte
byt = 56
chanobj.SendMessage msgtData+msgtDataRaw, byt, , "OneByte"

'An array of bytes

Dim rgBytes(1 To 3) As Byte

rgBytes(1) = 15
rgBytes(2) = 98
rgBytes(3) = 2
chanobj.SendMessage msgtData+msgtDataRaw,_
    rgBytes, , "ArrayOfBytes"

'An array of Variants that are bytes

Dim vByt(1 To 3) As Variant
vByt(1) = CByte(15)
vByt(2) = CByte(98)
vByt(3) = CByte(2)
chanobj.SendMessage msgtData+msgtDataRaw,_
      vByt, , "ArrayOfVariants"

See Also

enumMessageType, OnMessage


Channels Collection Object

The Chat Protocol control Channels collection object is a standard Visual Basic collection object and uses the standard Add and Remove methods and the Item and Count properties.

This section lists the methods and properties supported by the Channels collection object.

Methods

Add, Remove

Properties

Count, Item


Properties

This section describes the properties associated with the Channels collection object.


Count Property

Description

Accesses the number of Channel objects in the Channels collection.

Syntax

value=object.Count

PartDescription
value Required. A long integer that contains the number of Channel objects in the Channels collection.
object Required. An object expression that evaluates to a Channels collection object.

Remarks

Access is read-only.

Examples

Dim lChannelCount As Long

lChannelCount = MsChatPr1.Channels.Count

Dim coll As Channels

Set coll = MsChatPr1.Channels
lChannelCount = coll.Channels.Count

See Also

Item


Item Property

Description

Accesses a channel in the collection. This is the default property of the Channels collection.

Syntax

value=object.Item[(Index)]

PartDescription
value Required. An object expression that evaluates to a Channel object.
object Required. An object expression that evaluates to a Channels collection object.
Index Optional. A variant. The channel index is 1-based. If no Index parameter is specified or if it is an empty variant, the channel with the highest index is returned by the Item property.

The Index parameter can also be a string that represents the unique channel key specified at creation time in the Add method.

Remarks

Access is read-only.

Because Item is the default property of the Channels collection, the keyword "Item" can be omitted.

Examples

MsChatPr1.Channels.Add 1, "One"
MsChatPr1.Channels.Add 2, "Two"
MsChatPr1.Channels.Add 3, "Three"
MsChatPr1.Channels.Add 4, "Four"

Dim c As Channel

Set c = MsChatPr1.Channels.Items(4)
    'is equivalent to
Set c = MsChatPr1.Channels(4)
    'is equivalent to
Set c = MsChatPr1.Channels("Four")
    'is equivalent to
Set c = MsChatPr1.Channels.Item

Dim coll As Channels
Dim chan1, chan2 As Channel

Set coll = MsChatPr1.Channels

Set chan1 = coll.Add(1, "Foo")
Set chan2 = coll.Item(1)

See Also

Add


Methods

This section describes the methods associated with the Channels collection object.


Add Method

Description

Adds a Channel object to the Channels collection.

Syntax

value=object.Add[(Index][, Key)]

PartDescription
value Required. An object expression that evaluates to a Channel object. This will contain the newly added Channel object.
object Required. An object expression that evaluates to a Channels collection object.
Index Optional. A variant. If specified, it must be empty or a valid index that is a number between 1 and the current collection Count + 1.
Key Optional. A variant. If specified, it must be empty or a unique string that will identify the new Channel object.

Examples

Dim chan1, chan2 As Channel

Set chan1 = MsChatPr1.Channels.Add(1, "Questions")
Set chan2 = MsChatPr1.Channels.Add(2, "Answers")

MsChatPr1.Channels.Add

MsChatPr1.Channels.Add , "Aud"

MsChatPr1.Channels.Add 5

See Also

Index


Remove Method

Description

Removes a Channel object from the Channels collection.

Syntax

object.Remove Index

PartDescription
object Required. An object expression that evaluates to a Channels collection object.
Index Required. A variant. Index can be a number between 1 and the current collection Count, or the unique channel key.

Examples

MsChatPr1.Channels.Remove 4

MsChatPr1.Channels.Remove "Aud"

See Also

Item


ChatItems Object

The Chat Protocol control supports sophisticated querying through the ChatItems object. These queries relate to the Server, Channel, a Member, or a User. Usually the information provided by the server is exposed to the developer through the ChatItems object.

This section lists the properties and method supported by the ChatItems object.

Properties

AssociatedType, Item, ItemValid, ValidItems

Method

InvalidateItem

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.