Being connected to your chat accounts from multiple resources is something very common. I – for example – am constantly connected to my chat accounts from my PC and smart-phone, that is 2 resources at least. The issue that arises now is the following: What happens when you receive a message while connected from multiple resources to the same account? Which resource gets the notification? And most importantly: If you use encryption, with which resource’s key is the message encrypted?
That is something that is regulated with the xmpp priorities. The xmpp/jabber protocol that is widely used allows you to define a priority value in every resource you connect to your account. Assume 2 resources are connected to your Gmail account (Gmail and Facebook uses xmpp/jabber): You are connected from your PC through Pidgin, and through your phone with a another xmpp client like ChatSecure.
With the default settings, when you receive a message, you will get notifications in both your phone and your PC – or even just receive them just on the phone, or on the computer only. It can be a real annoyance if you use the OTR plugin to encrypt your chats (and you should…), you might end up receiving messages on your computer that are unreadable, because they were encrypted with your phone’s key. So, what should you do?
For example with Pidgin, will need to install the package pidgin-plugin-pack so that you enable the resource priority settings to be set in your pidgin. Give in your terminal:
sudo apt-get install pidgin-plugin-pack
This will allow you to set the priority settings in your xmpp/jabber account settings. Go in the account settings, in the “Advanced” tab and set the values as following:
This means that the priority on your pidgin will be 2 when you are actually using your computer and you are set as “Available”. When Pidgin switches your status to “Away” due to inactivity (you have your computer running but there is no activity on it, you are not on the desktop), the resource’s priority will be set to 0.
Why those 2 values? Because it leaves you space to set the value to “1” on the phone! This is a very reasonable scenario: Your computer is connected and online, but you are not in front of it at the moment. In this situation, your messages will be directed to your phone, that is set to priority 1. With ChatSecure for example, go to your account’s advanced settings to set it like that:
As I said again, mixing up priorities can be a real pain in the neck, especially when you use encryption, as it is very annoying to be sitting on the computer and keep receiving unreadable messages from your friends because the phone “steals” priority and messages are encrypted with the phone’s key.
The same principle you can follow to set up all your devices and clients, as long as they support the resource priority settings.
Enjoy trouble-less chatting!