Page 1 of 1

[SOLVED] Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 11:18 am
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 !

Re: Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 3:35 pm
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"
    }
  }
]

Re: Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 6:12 pm
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

Re: Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 6:24 pm
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.

Re: Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 6:25 pm
by Valware
Note that this is just my proposed change, there is a chance it might not be accepted as-is, or at all

Re: Suggestion: add away in json-RPC

Posted: Thu Sep 11, 2025 10:22 pm
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 :)

Re: Suggestion: add away in json-RPC

Posted: Mon Oct 13, 2025 8:41 am
by CrazyCat
Ok, testing UnrealIRCd-6.2.1-rc1 : away_since and away_reason works well in json-RPC
Nice job guys !