---
title: Resources and Priorities
description: A console-based XMPP client for power users.
sidebar:
  order: 6
---

## Overview

CProof offers flexible handling of resource and priority settings.

If you only connect to your chat service from the same computer (for example, you log in at work on your desktop and nowhere else), you probably don’t need to worry about these settings.

If you’re already familiar with resources and priorities and want to configure them in CProof, you can skip this overview and go straight to the [settings](#setting-the-resource) section.

However, if you frequently connect from multiple devices and want to ensure messages are routed correctly—but aren’t sure how—this brief overview will help before you move on to the settings below.

### Resources

The XMPP protocol allows users to connect from more than one place at a time. For example, you might connect from your laptop, desktop, tablet, and phone. Or, less commonly, from two Jabber clients on the same device, like CProof and Miranda.

Contacts are identified by JIDs (Jabber IDentifiers), which have the form:

```plaintext
localpart@domainpart
```

For example:

```plaintext
friends.name@ourserver.org

localpart = friends.name  
domainpart = ourserver.org
```

This is enough to identify a contact. However, when a contact connects to a chat service using a Jabber client, that client instance is represented as a **resource**.

So, while a contact can be identified as _localpart@domainpart_ (called a **bare JID**), their connection from a specific client is identified as _localpart@domainpart/resourcepart_ (called a **full JID**).

For example, a contact `some.friend@chat.server.org` logs in from both their laptop and phone. The software on the laptop uses the resource name `laptop` and the phone uses `phone`.

This contact can be identified as:

```plaintext
some.friend@chat.server.org
```

And they have two connected resources:

```plaintext
some.friend@chat.server.org/laptop
some.friend@chat.server.org/phone
```

When you receive a message, it will come from a **full JID**, i.e. from the specific client the contact is using.

You might not always be aware of the resource; most clients use a default (often the client software's name), which you can usually find in its settings.

If the client software provides no default, the chat service will generate a unique resource name. That’s why sometimes you see long strings like this after a contact’s name:

```plaintext
someone@theserver.com/b2be5700-73ed-4922-91be-f4bd5ae1526a
```

### Priorities

Since a user may be connected using more than one client, the server needs to know where to route messages, therefore resources are given a priority

A priority is a number between -128 and 127.

The exact rules to determine which resource (laptop or phone, for example) gets a message, vary between server implementations, but most follow something like the following:

```plaintext
Find the resource with the highest priority
Send the message to that resource
If two resources have the same priority, send to both
If the only resources available have a negative number, store the message until a resource connects with a priority of 0 or higher
```

If we go back to the example above, adding a priority to each resource:

Contact:

```plaintext
some.friend@chat.server.org
```

Connected Resources:

```plaintext
some.friend@chat.server.org/laptop, priority = 5
some.friend@chat.server.org/phone, priority = 20
```

If we send a message to our contact:

```bash
/msg some.friend@chat.server.org Hi there!
```

The message will be delivered to the contact's phone

The following sections show how to set the resource name, and priority for CProof.

## Setting the resource

To set the resource for a particular account in CProof, use the [`/account`](/command-reference#account) command:

For example to set the resource for the account work to _laptop_:

```bash
/account set work resource laptop
```

To find out what resource name is being used at any time:

```bash
/account show work
```

Or, if you are logged in:

```bash
/account
```

Will show the settings for the current account.

## Setting priority

To set the priority for an account whilst logged in use the [`/priority`](/command-reference#priority) command:

```bash
/priority 10
```

This will set the priority to 10 for this account. Whether you are online, away, dnd etc, the priority will always be 10.

For more flexible priority settings per presence, see the next section.

## Setting priority per presence

You may set a different priority for each presence for an account. This is useful, for example, if you want messages to be routed to your phone, when your desktop client becomes away.

To set the priority for a particular presence for an account, use the [`/account`](/command-reference#account) command.

```bash
/account set work away 0
/account set work online 20
```

Whenever your work account becomes away including [`autoaway`](/command-reference#autoaway) the priority will be set to 0.

When the account is online the priority will be 20.

To find out the priority associated with each presence for an account at any time:

```bash
/account show work
```

Or, if you are logged in:

```bash
/account
```

Will show the settings for the current account.
