sylae / ligrev

XMPP MUC Utility bot
GNU General Public License v3.0
2 stars 1 forks source link

Better $roster format #42

Closed sylae closed 8 years ago

sylae commented 8 years ago

When Ligrev first started there was no concept of a roster, messages came in with a from element and that was that. Then we added basic roster support, but the most it got into it was "This room occupant happens to have this JID".

However, especially with stuff like #36 querying a JID directly, rather than a room occupant, the current roster system is getting rather clunky and could use some help.

Ideally, the current roster format would be kept, but only used for MUC-related things:

$roster = array(
  'room@conference.example.com' = array(
    'member_nick' => array(
      'affiliation' => 'admin'
      'role' => ''
      'jid' => $real_jid
      ...
    ),
  ),
);

$real_jid in the above example would be a reference to an element of a new array, something like this:

$jids = array(
  'user@example.net/resouce' => array( // XMPPJid->to_string()
    'jid' => (XMPPJid object),
    'tzo' => "-07:00",
    'locale' => "en_US"
  ),
);

This'll take recoding quite a bit of the stuff that touches $roster, but it'll be worth it in the end, especially if we ever want to actually support locale stuff.

sylae commented 8 years ago

I'm actually gonna move this up, because otherwise everything is going to be steadily increasing levels of clusterfuck.

sylae commented 8 years ago

So the MEGA-EDIT handled most of the transition stuff, there's still a giant clusterfuck with replacing globals with class members, and the IQ code hasn't been touched. Let's see what blows up first.

sylae commented 8 years ago

Nothing's blown up yet, and while some things are kinda clunky, it's all working together relatively well...