[SOLVED] Suggestion: add away in json-RPC

Questions/suggestions/support regarding the admin panel, the JSON-RPC interface and other such software

Moderator: Supporters

Post Reply
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

[SOLVED] Suggestion: add away in json-RPC

Post by CrazyCat »

Hi,

I'm trying to use json-rpc from unrealircd rather than irc2sql from anope, and one information lacks in the user()->getuser() result: the online/away status of the user.

Thanks !
Valware
Official supporter
Posts: 76
Joined: Wed Mar 31, 2021 3:17 am
Location: Internet
Contact:

Re: Suggestion: add away in json-RPC

Post by Valware »

Hi, thanks for your feature request.

I've added your request to the bug reports manager, you can keep track of its status here: https://bugs.unrealircd.org/view.php?id=6573

I've also make a Pull Request to the main unrealircd repository which, if accepted, will include the user's away information in the JSON response output in this format:

Code: Select all

[
  {
    "name": "Valware",
    "id": "001H5M301",
    "hostname": "192.168.1.104",
    "ip": "192.168.1.104",
    "details": "[email protected]",
    "server_port": 6697,
    "client_port": 37862,
    "connected_since": "2025-09-11T15:14:31.000Z",
    "idle_since": "2025-09-11T15:14:31.000Z",
    "user": {
      "username": "valware",
      "realname": "realname",
      "vhost": "11B7A0AB.593AE83B.67DE9FFD.IP",
      "cloakedhost": "11B7A0AB.593AE83B.67DE9FFD.IP",
      "servername": "irc.valware.uk",
      "reputation": 0,
      "security-groups": [
        "unknown-users",
        "tls-users"
      ],
      "away": {
        "is_away": false,
        "away_reason": null,
        "away_since": null
      },
      "modes": "iwxz",
      "channels": [
        {
          "name": "#opers",
          "level": "o"
        }
      ]
    },
    "tls": {
      "cipher": "TLSv1.3/X25519/TLS_CHACHA20_POLY1305_SHA256"
    }
  }
]
Got an idea for a module? Don't be shy! Come talk to me on #unreal-support
Like the support? Consider supporting us with a donation.
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Suggestion: add away in json-RPC

Post by CrazyCat »

Nice, thanks.

Will it also be present in a channel.get (detail level 5) ? I didn't look at the json-rpc engine so I don't know if it uses directly the user object
Valware
Official supporter
Posts: 76
Joined: Wed Mar 31, 2021 3:17 am
Location: Internet
Contact:

Re: Suggestion: add away in json-RPC

Post by Valware »

The patch I suggested patches the way Client (and child) structs are converted to JSON objects, so it'll be available in any call which contains a user with detail level 2 or higher or channel with detail level of 4 or higher, which means the default calls will include them.
Got an idea for a module? Don't be shy! Come talk to me on #unreal-support
Like the support? Consider supporting us with a donation.
Valware
Official supporter
Posts: 76
Joined: Wed Mar 31, 2021 3:17 am
Location: Internet
Contact:

Re: Suggestion: add away in json-RPC

Post by Valware »

Note that this is just my proposed change, there is a chance it might not be accepted as-is, or at all
Got an idea for a module? Don't be shy! Come talk to me on #unreal-support
Like the support? Consider supporting us with a donation.
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Suggestion: add away in json-RPC

Post by CrazyCat »

Well, my servers are ready to upgrade to 6.2.0 (my test server didn't have any trouble with the beta version).
So, if Syzop does'nt accept your PR, I roll back my servers :)

More seriously, if this info exists in the rpc-json, it's a good thing, but if it doesn't, I can live without it :)
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Suggestion: add away in json-RPC

Post by CrazyCat »

Ok, testing UnrealIRCd-6.2.1-rc1 : away_since and away_reason works well in json-RPC
Nice job guys !
Post Reply