How to: Block private messages on IRC

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
xenopeek
Level 25
Level 25
Posts: 29595
Joined: Wed Jul 06, 2011 3:58 am

How to: Block private messages on IRC

Post by xenopeek »

If you've been on IRC for a while you've probably encountered somebody you don't know sending you private messages. It can be quite distracting if not annoying. Luckily you can easily block private messages.

There are three so called user modes you can set to block private messages (setting user mode R is a sane default):
  • c: blocks private messages from users that don't share a channel with you (probably keeps out all network wide trolls)
  • R: blocks private messages from users with unregistered nicks (probably keeps out all trolls)
  • g: blocks private messages from everybody you haven't approved (when somebody that you haven't approved yet sends you a private message, they will be informed you are blocking those and you will be informed they tried to send to you and remind you how you can approve them)
    • to add somebody to your list type: /accept +nick
    • to remove somebody from your list type: /accept -nick
    • to show who is on your list: /accept *
To set a user mode for the current session only, for example to set R, type:

Code: Select all

/umode +R
To remove a user mode for the current session only, for example to remove R, type:

Code: Select all

/umode -R
Likely you'll want to automatically set the user mode when you connect:
  • To do this in HexChat (the default IRC client on Cinnamon, MATE, and Xfce):
    • open HexChat > Network List from its menu
    • select the network you want to edit (e.g., select "Linux Mint") and click Edit
    • go to the Connect Commands tab and press Add
    • type the command there and press Enter to add it (note that the / will be dropped from the command you entered, which is fine)
  • To do this in Konversation (the default IRC client on KDE):
    • open File > Server List from its menu
    • select the network you want to edit (e.g., select "Linux Mint") and click Edit
    • type the command there in the Commands textbox
  • Bonus for weechat users:
    • The convenient accept alias isn't set by default on weechat but you can easily add it with:

      Code: Select all

      /alias add accept quote ACCEPT
    • To automatically set the user mode when you connect change your irc.server.<network name>.command setting.
Image
User avatar
JOPETA
Level 17
Level 17
Posts: 7762
Joined: Thu Nov 20, 2014 6:10 am
Location: En un lugar de cuyo nombre no quiero acordarme

Re: How to: Block private messages on IRC

Post by JOPETA »

With Xchat is easier to me creating a script in order to set the user modes when connecting. The Connect Command window is placed down Favourites Channels and can see almost nothing when typing because of space lack. In other hand, having installed different IRC clients, desktop environments or Linux systems, the script can be shared, copy&pasted,... This is the way I proceed.

First you need to create the script file wherever you want to place it ( ./xchat2 folder is a good idea for most users) and name it (name.conf is OK now). The contents of the file will be your desire user mode to block private message and the nicks you want to approve.

Code: Select all

UMODE +R
UMODE +g
/ACCEPT +nick1  
/ACCEPT +nick2
Then, do as in Hexchat case ( Xchat>Networklist..>Select the correct one from the list "Linux MInt">Edit) but in Connect Command type following codes to load the script

Code: Select all

LOAD -e /home/USER/.xchat2/name.conf
Only one last thing. If there's a nick you accept that is not connected when starting IRC client, you will have an advertisement telling you need to approve him as soon as he try to open a private dialog with you. Cheers :wink:
Post Reply

Return to “Tutorials”