Page MenuHomePhabricator

look for new messages on all projects
Open, NormalPublic

Description

Huggle is periodically looking for new messages on a WikiSite you are logged to. In case you are logged to multiple projects in same time, it should look for new messages on all of them.

Basically all what's needed is to take the current code that checks new messages and apply it in a loop for every WikiSite.


Version: unspecified
Severity: enhancement

Details

Reference
bz68502

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:29 AM
bzimport added projects: Huggle, good first bug.
bzimport set Reference to bz68502.
Petrb created this task.Jul 24 2014, 10:48 AM
Petrb moved this task from Backlog to Doing on the Huggle board.Nov 25 2014, 3:08 PM
Restricted Application added subscribers: Luke081515, Aklapper. · View Herald TranscriptAug 22 2015, 8:47 PM

@Petrb You moved this to Doing back in November 2014. SHould it be moved back to Backlog, or has it been fixed?

Petrb set Security to None.
Restricted Application added a subscriber: Matthewrbowker. · View Herald TranscriptNov 10 2015, 8:27 AM
Petrb added a comment.Nov 10 2015, 8:27 AM

I will mentor this task

@Petrb: Could you edit the task description to elaborate a bit more (provide pointers) what Huggle currently does, and what a contributor is expected to do exactly? After that we can import this into the GCI site...

Hi, I want to work on this. Is someone else working on it? Can someone direct me to the right direction?

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptNov 4 2016, 8:19 PM
Framawiki added a subscriber: Framawiki.
SAFAL12358 removed a subscriber: SAFAL12358.

Does this still need to be worked on? If yes, I am willing to do it.

Petrb added a comment.Nov 15 2018, 1:34 PM

Hello, yes

Petrb added a comment.Nov 15 2018, 1:46 PM

Currently the check for new messages is real crap.

There is a timer in Main Window you can see the code which is called here every 20 seconds: https://github.com/huggle/huggle3-qt-lx/blob/master/src/huggle_ui/mainwindow.cpp#L3058

The check creates a new API query here:

//! \todo Check this for every site we are logged to
this->qTalkPage = new ApiQuery(ActionQuery, this->GetCurrentWikiSite());
this->qTalkPage->Parameters = "meta=userinfo&uiprop=hasmsg";
this->qTalkPage->Process();

When I am looking at it it's actually quite broken at this moment, because GetCurrentWikiSite returns a wiki site of page that is currently displayed, but in case user login to multiple projects, it's always the wiki they are looking at in that moment, instead of home wiki...

The way this loop executed every 20 seconds works:

it checks if qTalkPage (API query) is currently being processed by checking if it's NULL. If it's NULL (not being processed) it launched new API query call. If it's not NULL it checks if previous API call is already finished and successful and then it checks if we got a new message or not. If yes, it changes flag Configuration::HuggleConfiguration->NewMessage which results in a notification about new message for every webpage that is loaded as next.

This needs to be completely reworked, there are many ways to do it, most simple (least coding) would be to preserve existing crappy mechanism and just change this qTalkPage API query pointer to an array of pointers, one for each site and do this all in a loop. The flag NewMessage should probably be replaced with an array as well, so that we know which sites have a new message or not.

More complicated, but proper solution would be to completely rewrite it so that it's more elegant than running a timer every 20 seconds :) but I am not really sure how, so I am OK with "lazy" solution as well

And the code which generates new message warning probably needs to be updated as well to reflect multiple sites, it's here: https://github.com/huggle/huggle3-qt-lx/blob/master/src/huggle_ui/genericbrowser.cpp#L55 it's called GetShortcut which is pretty confusing, in past that function returned only shortcut used to display talk page, because this shortcut is in the message itself, but later whole HTML generating was moved there.

Let me know if anything isn't clear