Adium

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9131 closed defect (fixed)

AppleScript: contact group returns contacts instead of groups

Reported by: mtimmsj Owned by: applmak
Milestone: Adium 1.3 Component: AppleScript
Version: Severity: normal
Keywords: AppleScript contact groups Cc:
Patch Status:

Description

With the contact group code added to AppleScript via #9109 the contact groups should be available from the application, but when I run the following script I get contacts instead of groups:

tell application "Adium" to get every contact group

The same thing is seen if I run:

tell application "Adium" to get the first contact group

Change History (14)

comment:1 Changed 12 years ago by Jordan

Milestone: Adium X 1.2.2
Owner: changed from nobody to Matt Handley

comment:2 Changed 12 years ago by Matt Handley

Status: newassigned

That very much does not happen in my build (from svn). Did you quit and relaunch both script editor and adium before compiling the script?

comment:3 Changed 12 years ago by Jordan

Milestone: Adium X 1.2.2Needs feedback from users
pending: 01

I also get groups when running those commands...

comment:4 Changed 12 years ago by Mike

Milestone: Needs feedback from usersNeeds Feedback - Received
pending: 10

Ok I found the thing that seems to trigger this. If you disable "Show Groups" under the View menu, then it returns both contact groups and contacts.

comment:5 Changed 12 years ago by Jordan

Milestone: Needs Feedback - ReceivedGood idea for "later"

I believe that is because according to Adium, when you disable "Show Groups" it actually believes they are no longer in any group. This would likely be solved by the ticket regarding allowing contacts to be in more than one group at a time (#500). Setting to good idea for later... once you see #500 repaired, then we can milestone this.

comment:6 Changed 12 years ago by Matt Handley

Resolution: fixed
Status: assignedclosed

(In [22863]) The referenced bug is caused because of the (slightly odd) way that Adium handles its contacts. I have fixed it by ensuring that -[AIApplication contactGroups] only ever returns contact groups. Closes #9131.

comment:7 Changed 12 years ago by Robert

Milestone: Good idea for "later"Adium X 1.3

comment:8 Changed 12 years ago by Evan Schoenberg

Why was it returning contacts?

comment:9 Changed 12 years ago by Matt Handley

Because in order to get a list of the contact groups, I was calling [AIContactController allGroups], which assumes that all contactobjects below the root are groups. This is true when show groups is enabled, but when it is off, that list includes all the contacts. So, I now parse through the array returned from allGroups, and ensure that each item isKindOfClass:[AIContactGroup class].

comment:10 Changed 12 years ago by Evan Schoenberg

Oh, lord. [AIContactController allGroups] is dumb.

comment:11 Changed 12 years ago by Jordan

Evan: If you make changes to that so it only returns groups, you should notify dogtown08 - I believe his contact list search code was updated yesterday to include the same workaround as what Matt did here.

comment:12 Changed 12 years ago by Evan Schoenberg

(In [22866]) Removed poor implementation of -[AIContactController allGroups] and replaced it with a sane one. The only places this is used at all are for Applescript support (refs #9131, where the recent change [22863] can probably be reverted) and AIContactMenu (where it shouldn't be; see next commit)

comment:13 in reply to:  11 Changed 12 years ago by Evan Schoenberg

Replying to jas8522:

Evan: If you make changes to that so it only returns groups, you should notify dogtown08 - I believe his contact list search code was updated yesterday to include the same workaround as what Matt did here.

The code in HEAD, anyways, does not call -[AIContactController allGroups], so I don't think the fix with affect the searching stuff.

comment:14 Changed 12 years ago by Matt Handley

(In [22869]) Reverted r22863, as per Evan's recent change. Refs #9131.

Note: See TracTickets for help on using tickets.