Skip to content

v2.5.0 — a mailbox list that scales, and terminations that report honestly

Choose a tag to compare

@bradleygb bradleygb released this 02 Sep 21:10
· 2 commits to main since this release

Drop-in as always — extract over modules/servers/cwp7/ and run Test Connection. No
configuration changes, no database changes, nothing to reconfigure on existing services.

Includes everything from 2.3.0 and 2.4.0, which were never tagged.

Added

The mailbox list filters and pages. Ten to a page, with a filter box once there are more
than ten. An account with hundreds of addresses used to render every one of them, and every
row carried a hidden inline editor with three inputs behind it — five hundred mailboxes
meant a thousand table rows and no way to find anything among them.

email/list can't help here: its documented request takes key, action, user and
debug and nothing else, so the whole account arrives in one response and the paging has to
happen in the browser.

Account dashboard in the client area — disk, bandwidth, email accounts, FTP accounts,
databases and subdomains, from accountdetail/list.

Mailbox management from the client area — add, change password, change size, delete,
without sending customers into CWP. Off by default (mailbox_management in config.php);
needs ADD, UPD and DEL on Emails in addition to LIST.

Fixed

A termination that succeeded was reported as a failure. account/del answers
{"status":"OK"} and then appends its panel's HTML confirmation, which json_decode
rejects outright. WHMCS recorded a failed termination and left the service Suspended while
the account had already been deleted from the server.

The parser now takes the first complete JSON object off the front of a reply. It isn't
special-cased to delaccount/susp and account/unsp go through the same CWP
controller.

Suspend, unsuspend and terminate check the server before reporting a failure. If the
account is already gone, already suspended or already active, the request has done what it
was asked to do, whatever CWP said on the way. Absence counts as success for a termination
and as a fault for a suspension, so the two aren't treated alike.

Mailbox passwords and password hashes kept out of the WHMCS module log. email/list
returns every mailbox's {SHA512-CRYPT} hash with no way to suppress it, and email/add
calls the password pass while email/udp calls it password — masking by field name
caught only the first. It's masked by shape now.

The module log no longer stores an entire response body on every call. The client area
fetches the mailbox list on every page view, so a large account wrote hundreds of rows into
tblmodulelog each time somebody opened their service page. Bodies cap at 4000 bytes and
payload rows at 20, each saying how much was left out.

CWP API notes

Worked out the hard way against a live server, in case they save someone else the time:

  • email/add takes the local part only in its email field, not the whole address —
    CWP appends the domain itself. Send test@domain.co.za and you get
    testdomain.co.za@domain.co.za.
  • email/udp and email/del use mailbox (the full address) and password — not
    email and pass. The wrong names produce an HTTP 500 with Undefined offset: 1.
  • quota is ignored on email/add but applied on email/udp, in bytes.
  • changepack/udp takes a package ID only. A name comes back as a bare Error with no
    message.