# eric6.Network.IRC.IrcChannelWidget

Module implementing the IRC channel widget.

### Global Attributes

None

### Classes

IrcChannelWidget | Class implementing the IRC channel widget.
IrcUserItem | Class implementing a list widget item containing an IRC channel user.

### Functions

None

## IrcChannelWidget

Class implementing the IRC channel widget.

### Signals

channelClosed(str)
  emitted after the user has left the channel
openPrivateChat(str)
  emitted to open a "channel" for private messages
sendCtcpReply(str, str)
  emitted to send a CTCP reply
sendData(str)
  emitted to send a message to the channel

### Derived from

QWidget, Ui_IrcChannelWidget

### Class Attributes

JoinIndicator
LeaveIndicator
MessageIndicator
UrlRe

### Class Methods

None

### Methods

IrcChannelWidget | Constructor
__addManagementMessage | Private method to add a channel management message to the list.
__appendMessage | Private slot to append a message.
__autoWhoEntry | Private method to handle a WHO entry returned by the server as requested automatically.
__channelCreated | Private method to handle a channel created message.
__channelModes | Private method to handle a message reporting the channel modes.
__channelUrl | Private method to handle a channel URL message.
__clearMessages | Private slot to clear the contents of the messages display.
__copyAllMessages | Private slot to copy the contents of the messages display to the clipboard.
__copyMessages | Private slot to copy the selection of the messages display to the clipboard.
__cutAllMessages | Private slot to cut the contents of the messages display to the clipboard.
__extractPrivilege | Private method to extract the user privileges out of the name.
__findUser | Private method to find the user in the list of users.
__handleCtcp | Private method to handle a CTCP channel command.
__help | Private method to handle a help message.
__ignore | Private method to handle a channel message we are not interested in.
__initMessagesMenu | Private slot to initialize the context menu of the messages pane.
__initUsersMenu | Private slot to initialize the users list context menu.
__message | Private method to handle messages to the channel.
__openPrivateChat | Private slot to open a chat with the selected user.
__saveMessages | Private slot to save the contents of the messages display.
__sendAutoWhoCommand | Private slot to send the WHO command to update the users list.
__setEditTopicButton | Private method to set the visibility of the Edit Topic button.
__setTopic | Private method to handle a topic change of the channel.
__setUserPrivilege | Private method to handle a change of user privileges for the channel.
__topicCreated | Private method to handle a topic created message.
__updateChannelModes | Private method to handle a message reporting the channel modes.
__userAway | Private method to handle a topic change of the channel.
__userJoin | Private method to handle a user joining the channel.
__userList | Private method to handle the receipt of a list of users of the channel.
__userNickChange | Private method to handle a nickname change of a user.
__userPart | Private method to handle a user leaving the channel.
__userQuit | Private method to handle a user logging off the server.
__whoEnd | Private method to handle the end of the WHO list.
__whoEntry | Private method to handle a WHO entry returned by the server as requested manually.
__whoIs | Private slot to get information about the selected user.
__whoIsAccount | Private method to handle the WHOIS account reply.
__whoIsActually | Private method to handle the WHOIS actually reply.
__whoIsChannels | Private method to handle the WHOIS channels reply.
__whoIsConnection | Private method to handle the WHOIS connection reply.
__whoIsEnd | Private method to handle the end of WHOIS reply.
__whoIsHelper | Private method to handle the WHOIS helper reply.
__whoIsIdentify | Private method to handle the WHOIS identify and identified replies.
__whoIsIdle | Private method to handle the WHOIS idle reply.
__whoIsOperator | Private method to handle the WHOIS operator reply.
__whoIsSecure | Private method to handle the WHOIS secure reply.
__whoIsServer | Private method to handle the WHOIS server reply.
__whoIsUser | Private method to handle the WHOIS user reply.
addMessage | Public method to add a message from external.
addUsers | Public method to add users to the channel.
getUsersCount | Public method to get the users count of the channel.
handleMessage | Public method to handle the message sent by the server.
hideEvent | Protected method handling hide events.
initAutoWho | Public method to initialize the Auto Who system.
name | Public method to get the name of the channel.
on_editTopicButton_clicked | Private slot to change the topic of the channel.
on_messageEdit_returnPressed | Private slot to send a message to the channel.
on_messages_anchorClicked | Private slot to open links in the default browser.
on_messages_copyAvailable | Private slot to react to text selection/deselection of the messages edit.
on_messages_customContextMenuRequested | Private slot to show the context menu of the messages pane.
on_usersList_customContextMenuRequested | Private slot to show the context menu of the users list.
partMessage | Public method to get the part message.
requestLeave | Public method to leave the channel.
setMarkerLine | Public method to draw a line to mark the current position.
setName | Public method to set the name of the channel.
setPartMessage | Public method to set the part message.
setPrivate | Public method to set the private chat mode.
setPrivateInfo | Public method to set some info text for private chat mode.
setUserName | Public method to set the user name for the channel.
setUserPrivilegePrefix | Public method to set the user privilege to prefix mapping.
showEvent | Protected method handling show events.
unsetMarkerLine | Public method to remove the marker line.
userName | Public method to get the nick name of the user.

### Static Methods

None

#### IrcChannelWidget (Constructor)

IrcChannelWidget(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### IrcChannelWidget.__addManagementMessage

__addManagementMessage(indicator, message)

Private method to add a channel management message to the list.

indicator
  indicator to be shown (string)
message
  message to be shown (string)

#### IrcChannelWidget.__appendMessage

__appendMessage(message)

Private slot to append a message.

message
  message to be appended (string)

#### IrcChannelWidget.__autoWhoEntry

__autoWhoEntry(match)

Private method to handle a WHO entry returned by the server as requested automatically.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__channelCreated

__channelCreated(match)

Private method to handle a channel created message.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__channelModes

__channelModes(match)

Private method to handle a message reporting the channel modes.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__channelUrl

__channelUrl(match)

Private method to handle a channel URL message.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__clearMessages

__clearMessages()

Private slot to clear the contents of the messages display.

#### IrcChannelWidget.__copyAllMessages

__copyAllMessages()

Private slot to copy the contents of the messages display to the clipboard.

#### IrcChannelWidget.__copyMessages

__copyMessages()

Private slot to copy the selection of the messages display to the clipboard.

#### IrcChannelWidget.__cutAllMessages

__cutAllMessages()

Private slot to cut the contents of the messages display to the clipboard.

#### IrcChannelWidget.__extractPrivilege

__extractPrivilege(name)

Private method to extract the user privileges out of the name.

name
  user name and prefixes (string)

Returns:
  list of privileges and user name (list of string, string)

#### IrcChannelWidget.__findUser

__findUser(name)

Private method to find the user in the list of users.

name
  user name to search for (string)

Returns:
  reference to the list entry (QListWidgetItem)

#### IrcChannelWidget.__handleCtcp

__handleCtcp(match)

Private method to handle a CTCP channel command.

match
  reference to the match object

Returns:
  flag indicating, if the message was handled (boolean)

#### IrcChannelWidget.__help

__help(match)

Private method to handle a help message.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__ignore

__ignore(match)

Private method to handle a channel message we are not interested in.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__initMessagesMenu

__initMessagesMenu()

Private slot to initialize the context menu of the messages pane.

#### IrcChannelWidget.__initUsersMenu

__initUsersMenu()

Private slot to initialize the users list context menu.

#### IrcChannelWidget.__message

__message(match)

Private method to handle messages to the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__openPrivateChat

__openPrivateChat()

Private slot to open a chat with the selected user.

#### IrcChannelWidget.__saveMessages

__saveMessages()

Private slot to save the contents of the messages display.

#### IrcChannelWidget.__sendAutoWhoCommand

__sendAutoWhoCommand()

Private slot to send the WHO command to update the users list.

#### IrcChannelWidget.__setEditTopicButton

__setEditTopicButton()

Private method to set the visibility of the Edit Topic button.

#### IrcChannelWidget.__setTopic

__setTopic(match)

Private method to handle a topic change of the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__setUserPrivilege

__setUserPrivilege(match)

Private method to handle a change of user privileges for the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__topicCreated

__topicCreated(match)

Private method to handle a topic created message.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__updateChannelModes

__updateChannelModes(match)

Private method to handle a message reporting the channel modes.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userAway

__userAway(match)

Private method to handle a topic change of the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userJoin

__userJoin(match)

Private method to handle a user joining the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userList

__userList(match)

Private method to handle the receipt of a list of users of the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userNickChange

__userNickChange(match)

Private method to handle a nickname change of a user.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userPart

__userPart(match)

Private method to handle a user leaving the channel.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__userQuit

__userQuit(match)

Private method to handle a user logging off the server.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoEnd

__whoEnd(match)

Private method to handle the end of the WHO list.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoEntry

__whoEntry(match)

Private method to handle a WHO entry returned by the server as requested manually.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIs

__whoIs()

Private slot to get information about the selected user.

#### IrcChannelWidget.__whoIsAccount

__whoIsAccount(match)

Private method to handle the WHOIS account reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsActually

__whoIsActually(match)

Private method to handle the WHOIS actually reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsChannels

__whoIsChannels(match)

Private method to handle the WHOIS channels reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsConnection

__whoIsConnection(match)

Private method to handle the WHOIS connection reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsEnd

__whoIsEnd(match)

Private method to handle the end of WHOIS reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsHelper

__whoIsHelper(match)

Private method to handle the WHOIS helper reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsIdentify

__whoIsIdentify(match)

Private method to handle the WHOIS identify and identified replies.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsIdle

__whoIsIdle(match)

Private method to handle the WHOIS idle reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsOperator

__whoIsOperator(match)

Private method to handle the WHOIS operator reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsSecure

__whoIsSecure(match)

Private method to handle the WHOIS secure reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsServer

__whoIsServer(match)

Private method to handle the WHOIS server reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.__whoIsUser

__whoIsUser(match)

Private method to handle the WHOIS user reply.

match
  match object that matched the pattern

Returns:
  flag indicating whether the message was handled (boolean)

#### IrcChannelWidget.addMessage

addMessage(sender, msg)

Public method to add a message from external.

sender
  nick name of the sender (string)
msg
  message received from sender (string)

#### IrcChannelWidget.addUsers

addUsers(users)

Public method to add users to the channel.

users
  list of user names to add (list of string)

#### IrcChannelWidget.getUsersCount

getUsersCount()

Public method to get the users count of the channel.

Returns:
  users count of the channel (integer)

#### IrcChannelWidget.handleMessage

handleMessage(line)

Public method to handle the message sent by the server.

line
  server message (string)

Returns:
  flag indicating, if the message was handled (boolean)

#### IrcChannelWidget.hideEvent

hideEvent(evt)

Protected method handling hide events.

evt
  reference to the hide event (QHideEvent)

#### IrcChannelWidget.initAutoWho

initAutoWho()

Public method to initialize the Auto Who system.

#### IrcChannelWidget.name

name()

Public method to get the name of the channel.

Returns:
  name of the channel (string)

#### IrcChannelWidget.on_editTopicButton_clicked

on_editTopicButton_clicked()

Private slot to change the topic of the channel.

#### IrcChannelWidget.on_messageEdit_returnPressed

on_messageEdit_returnPressed()

Private slot to send a message to the channel.

#### IrcChannelWidget.on_messages_anchorClicked

on_messages_anchorClicked(url)

Private slot to open links in the default browser.

url
  URL to be opened (QUrl)

#### IrcChannelWidget.on_messages_copyAvailable

on_messages_copyAvailable(yes)

Private slot to react to text selection/deselection of the messages edit.

yes
  flag signaling the availability of selected text (boolean)

#### IrcChannelWidget.on_messages_customContextMenuRequested

on_messages_customContextMenuRequested(pos)

Private slot to show the context menu of the messages pane.

pos
  the position of the mouse pointer (QPoint)

#### IrcChannelWidget.on_usersList_customContextMenuRequested

on_usersList_customContextMenuRequested(pos)

Private slot to show the context menu of the users list.

pos
  the position of the mouse pointer (QPoint)

#### IrcChannelWidget.partMessage

partMessage()

Public method to get the part message.

Returns:
  part message (string)

#### IrcChannelWidget.requestLeave

requestLeave()

Public method to leave the channel.

#### IrcChannelWidget.setMarkerLine

setMarkerLine()

Public method to draw a line to mark the current position.

#### IrcChannelWidget.setName

setName(name)

Public method to set the name of the channel.

name
  of the channel (string)

#### IrcChannelWidget.setPartMessage

setPartMessage(message)

Public method to set the part message.

message
  message to be used for PART messages (string)

#### IrcChannelWidget.setPrivate

setPrivate(private, partner="")

Public method to set the private chat mode.

private
  flag indicating private chat mode (boolean)
partner
  name of the partner user (string)

#### IrcChannelWidget.setPrivateInfo

setPrivateInfo(infoText)

Public method to set some info text for private chat mode.

infoText
  info text to be shown (string)

#### IrcChannelWidget.setUserName

setUserName(name)

Public method to set the user name for the channel.

name
  user name for the channel (string)

#### IrcChannelWidget.setUserPrivilegePrefix

setUserPrivilegePrefix(prefixes)

Public method to set the user privilege to prefix mapping.

prefixes
  dictionary with privilege as key and prefix as value

#### IrcChannelWidget.showEvent

showEvent(evt)

Protected method handling show events.

evt
  reference to the show event (QShowEvent)

#### IrcChannelWidget.unsetMarkerLine

unsetMarkerLine()

Public method to remove the marker line.

#### IrcChannelWidget.userName

userName()

Public method to get the nick name of the user.

Returns:
  nick name of the user (string)

Up

## IrcUserItem

Class implementing a list widget item containing an IRC channel user.

### Derived from

QListWidgetItem

### Class Attributes

Admin
Away
Halfop
Normal
Operator
Owner
PrivilegeMapping
Voice

### Class Methods

None

### Methods

IrcUserItem | Constructor
__awayIcon | Private method to convert an icon to an away icon.
__setIcon | Private method to set the icon dependent on user privileges.
canChangeTopic | Public method to check, if the user is allowed to change the topic.
changePrivilege | Public method to set or unset a user privilege.
clearPrivileges | Public method to clear the user privileges.
name | Public method to get the user name.
parseWhoFlags | Public method to parse the user flags reported by a WHO command.
setName | Public method to set a new nick name.

### Static Methods

None

#### IrcUserItem (Constructor)

IrcUserItem(name, parent=None)

Constructor

name
  string with user name and privilege prefix (string)
parent
  reference to the parent widget (QListWidget or QListWidgetItem)

#### IrcUserItem.__awayIcon

__awayIcon(icon)

Private method to convert an icon to an away icon.

icon
  icon to be converted (QIcon)

Returns:
  away icon (QIcon)

#### IrcUserItem.__setIcon

__setIcon()

Private method to set the icon dependent on user privileges.

#### IrcUserItem.canChangeTopic

canChangeTopic()

Public method to check, if the user is allowed to change the topic.

Returns:
  flag indicating that the topic can be changed (boolean)

#### IrcUserItem.changePrivilege

changePrivilege(privilege)

Public method to set or unset a user privilege.

privilege
  privilege to set or unset (string)

#### IrcUserItem.clearPrivileges

clearPrivileges()

Public method to clear the user privileges.

#### IrcUserItem.name

name()

Public method to get the user name.

Returns:
  user name (string)

#### IrcUserItem.parseWhoFlags

parseWhoFlags(flags)

Public method to parse the user flags reported by a WHO command.

flags
  user flags as reported by WHO (string)

#### IrcUserItem.setName

setName(name)

Public method to set a new nick name.

name
  new nick name for the user (string)

Up