Closed Bug 954796 Opened 11 years ago Closed 11 years ago

JS-IRC does not set buddy status to "unavailable" when buddy away.

Categories

(Chat Core :: IRC, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: aleth, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

*** Original post on bio 1362 at 2012-04-06 00:18:00 UTC *** This would seem to precede bug 954792 (bio 1358).
Attached patch Partial fix (obsolete) (deleted) — Splinter Review
*** Original post on bio 1362 as attmnt 1309 at 2012-04-06 10:33:00 UTC *** This goes a long way towards fixing this problem: It sets the status to unavailable when we receive that information, and sets the away message accordingly, which appears in the DM conv top, fixing 1358. Problems: - Receiving a message from someone does not remove the Away flag and change the status to available. (easily fixed) - 303 ISON response will set the status of buddies that are away back to available, even if they are not. (not sure what to do about this)
Comment on attachment 8353062 [details] [diff] [review] Partial fix *** Original change on bio 1362 attmnt 1309 at 2012-04-06 11:17:55 UTC *** Not really requesting review yet, but requesting comments on the above issues.
Attachment #8353062 - Flags: review?(clokep)
Attached patch Partial fix (deleted) — Splinter Review
*** Original post on bio 1362 as attmnt 1314 at 2012-04-06 11:39:00 UTC *** Is this the best one can do? Also, am not sure where to add the "set to available when we receive a message" code.
Attachment #8353067 - Flags: review?(clokep)
Comment on attachment 8353062 [details] [diff] [review] Partial fix *** Original change on bio 1362 attmnt 1309 at 2012-04-06 11:40:01 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353062 - Attachment is obsolete: true
Attachment #8353062 - Flags: review?(clokep)
Comment on attachment 8353067 [details] [diff] [review] Partial fix *** Original change on bio 1362 attmnt 1314 at 2012-04-06 11:59:48 UTC *** >diff --git a/modules/ircBase.jsm b/modules/ircBase.jsm >@@ -144,16 +144,23 @@ function setWhoIs(aAccount, aMessage, aFields) { > > // Set non-normalized nickname field. > aAccount.whoisInformation[buddyName]["nick"] = aMessage.params[1]; > > // Set the WHOIS fields. > for (let field in aFields) > aAccount.whoisInformation[buddyName][field] = aFields[field]; > >+ // If 'Away' is being set, reflect this in the buddy status. >+ if ("away" in aFields) { >+ let buddy = aAccount.getBuddy(buddyName); >+ if (buddy) >+ buddy.setStatus(Ci.imIStatusInfo.STATUS_UNAVAILABLE, aFields["away"]); >+ } >+ > return true; > } Why do this here instead of in the 301 handler below? >@@ -592,18 +599,16 @@ var ircBase = { > "301": function(aMessage) { // RPL_AWAY > // <nick> :<away message> >- // TODO set user as away on buddy list / conversation lists >- // TODO Display an autoResponse if this is after sending a private message > return setWhoIs(this, aMessage, {away: aMessage.params[2]}); > }, >@@ -622,17 +627,18 @@ var ircBase = { > // online. > let status = (receivedBuddyNames.indexOf(buddyName) == -1) ? > Ci.imIStatusInfo.STATUS_OFFLINE : > Ci.imIStatusInfo.STATUS_AVAILABLE; > > // Set the status with no status message, only if the buddy actually > // exists in the buddy list. > let buddy = this.getBuddy(buddyName); >- if (buddy) >+ if (buddy && !(buddy.statusType == Ci.imIStatusInfo.STATUS_UNAVAILABLE >+ && status == Ci.imIStatusInfo.STATUS_AVAILABLE)) I think we should get rid of the ternary operator here and actual do a couple of buddy if statements now...i.e. if (indexOf != -1 && buddy && buddy.statusType <= Ci.imIStatusInfo.STATUS_OFFLINE) --> set to online > buddy.setStatus(status, ""); > } > return true; > }, The big problem I see with this patch is there's no way for a user to be marked as NOT away? Well without running a whois on the person again, but that's not being done currently...
Attachment #8353067 - Flags: review?(clokep) → review-
*** Original post on bio 1362 at 2012-04-06 12:14:48 UTC *** (In reply to comment #4) > Why do this here instead of in the 301 handler below? Because we also get info on the Away status of a nick when someone runs a whois, in particular on opening a DM by double-clicking a nick in the participant list. > The big problem I see with this patch is there's no way for a user to be marked > as NOT away? Well without running a whois on the person again, but that's not > being done currently... That's why I asked if it was a good idea to set a buddy to Available whenever we receive a message from that nick, and if so, where best to add that to the code. I don't think there is going to be a perfect solution given the limitations of IRC though. I think libpurple does a periodic whois on everybody, which is not good either. Best one can do is make use of all the info available at any time. Or is there something like ISON for Away?
*** Original post on bio 1362 at 2012-05-16 16:13:21 UTC *** I am resolving this as a WFM now bug 954803 (bio 1369) had landed (which seems to be the best one can do for buddies).
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: