How to: Block private messages on IRC

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
User avatar
xenopeek
Level 24
Level 24
Posts: 21467
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

How to: Block private messages on IRC

Postby xenopeek » Wed Jan 27, 2016 4:38 pm

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: /approve *
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 umode and accept aliases aren't set by default on weechat but you can easily add them with:

      Code: Select all

      /alias add umode mode $nick
      /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 11
Level 11
Posts: 3822
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

Postby JOPETA » Tue Sep 27, 2016 11:11 pm

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:


Return to “Tutorials”