Adium

Ticket #8160 (closed defect: fixed)

Opened 2 years ago

Last modified 20 months ago

Spotlight display issue for chat logs

Reported by: sanmarcos Owned by: nobody
Milestone: Adium 1.2 Component: Logging
Version: 1.1.3 Severity: normal
Keywords: spotlight search logs Cc:
Patch Status: Accepted

Description (last modified by Catfish_Man) (diff)

When trying to search logs in spotlight, I get what you see in the screenshot. Opening the result however does open Adium Log Viewer.

Attachments

spotlight_importer_fixes.diff (16.3 KB) - added by Westacular 2 years ago.
Several fixes to Adium's indexing of .chatlog files

Change History

  Changed 2 years ago by sanmarcos

  Changed 2 years ago by Catfish_Man

  • description modified (diff)
  • milestone set to Adium X 1.2

follow-up: ↓ 5   Changed 2 years ago by boredzo

It *works*, in that it finds the log. The bug is in display only.

Also, the display works correctly when the search is for a recipient. Only content searches return the weird display.

  Changed 2 years ago by boredzo

I think I've figured it out. Search for <message.

It's matching based on the raw XML, not the actual text content. Spotlight is displaying it in that context.

in reply to: ↑ 3   Changed 2 years ago by moehnetiger

Replying to boredzo:

It *works*, in that it finds the log. The bug is in display only.

I do experience a bug when I try to open the search results (.chatlog format):

Doublecliking a .chatlog file in the Adium Log Viewer, which is basically correct, BUT inside the Log Viewer, I'll get the wrong chatlog. I don't get the one I just double-clicked, no... the most recent chatlog is selected instead. So I have to do a second search using the the searchfild inside the Log Viewer.

Also, the display works correctly when the search is for a recipient. Only content searches return the weird display.

Hm... weird, I always, get the same display style in the spotlight search window/or search menu. No matter if I search for contact names, aim/jabber/msn-nicks, chat content or if i just search for <message like you suggestet in an other post: I always get the search result displayed as sender="nickname" on yy-mm-dd

I'm using Adium 1.1.3 and Mac OS X 10.4.10 on a iBook G4 (if that info is important).

  Changed 2 years ago by sanmarcos

I am using Adium 1.1.3 also, and Mac OS X 10.4.10 on an Aluminum iMac. This seems to be a pretty serious bug to Adium's spotlight plugin.

Thank you.

  Changed 2 years ago by zacw

  • summary changed from Spotlight searching doesnt work to Spotlight display issue for chat logs

  Changed 2 years ago by Westacular

There are several significant bugs in the .chatlog spotlight importer. This is the most visible one. Looking at the code (and its output) it seems that no one has seriously looked at this.

The issue is that when the importer sets the kMDItemDisplayName field, it calls objectValue on an NSXMLNode object (GetMetadataForFile.m line 170), which for attribute nodes gives a string of the form

attributename="attributevalue"

when instead it should be calling stringValue, which would return just attributevalue (the intended behaviour).

There's a similar issue at line 131 which results in the kMDItemAuthors field never being set (it passes an array of NSXMLNode rather than an array of NSString). Also, the kMDItemDurationSeconds field is always set to 0 because it erroneously uses the same value for endDate as startDate when calculating the duration.

In the header of the file, it notes the field kMDItemInstantMessageAddresses. It would make sense to set a value for that -- it would be the same value that it's currently trying (and failing) to set for kMDItemAuthors.

I've never done anything with Adium code before but I'm going to take a shot at making these fixes.

  Changed 2 years ago by Westacular

A slight correction to my previous comment: The issue with kMDItemDisplayName is not in the use of objectValue; it's actually the result of the problem with kMDItemAuthors and the authorsArray.

  Changed 2 years ago by evands

We'll be happy to review a patch fixing this up -- thanks for looking into it :)

Changed 2 years ago by Westacular

Several fixes to Adium's indexing of .chatlog files

  Changed 2 years ago by Westacular

Changes in the patch:

* Fixed output to kMDItemAuthors field.
* Fixed the formatting of output to kMDDisplayName
* Fixed the calculation of kMDDurationSeconds
* Added output of "Adium" to kMDItemCreator
* Added output to kMDItemInstantMessageAddresses (same value as Authors)
* Removed kMDDisplayName entries from schema.xml (Apple says the file should only contain custom fields not defined elsewhere)

* Added com_adiumX_chatDestinations to schema.xml for xmllog format as a multivalued equivalent of com_adiumX_chatDestination for the htmllog format, which was never set for xmllogs. Added the appropriate entries to the .strings files.

* Added output to com_adiumX_chatDestinations (same value as Authors, minus the user's account)

* In Adium's main Info.plist file, under the file association for the xmllog format, changed the value of CFBundleTypeRole from None to Editor. (Since Adium can both save and read the format.) This makes it consistent with the respective value in Adium's htmllog entry, and with iChat's value for its log file format.

  Changed 2 years ago by zacw

  • patch_status changed from None to Needs Dev Review
  • milestone changed from Adium X 1.2 to Adium X 1.1.5

  Changed 2 years ago by sanmarcos

Thank you very much Westacular for coding a patch! I really hope this gets included in 1.1.5. :D

  Changed 2 years ago by evands

  • status changed from new to closed
  • resolution set to fixed

(In [21569]) Patch from Wesley "Westacular" Campaigne, who writes:

  • Fixed output to kMDItemAuthors field.
  • Fixed the formatting of output to kMDDisplayName
  • Fixed the calculation of kMDDurationSeconds
  • Added output of "Adium" to kMDItemCreator
  • Added output to kMDItemInstantMessageAddresses (same value as Authors)


* Removed kMDDisplayName entries from schema.xml (Apple says the file should only contain custom fields not defined elsewhere)

  • Added com_adiumX_chatDestinations to schema.xml for xmllog format as a multivalued equivalent of com_adiumX_chatDestination for the htmllog format, which was never set for xmllogs. Added the appropriate entries to the .strings files.
  • Added output to com_adiumX_chatDestinations (same value as Authors, minus the user's account)
  • In Adium's main Info.plist file, under the file association for the xmllog format, changed the value of CFBundleTypeRole from None to Editor. (Since Adium can both save and read the format.) This makes it consistent with the respective value in Adium's htmllog entry, and with iChat's value for its log file format.

Fixes #8160

  Changed 2 years ago by evands

(In [21571]) Merged [21569]: Patch from Wesley "Westacular" Campaigne, who writes:

  • Fixed output to kMDItemAuthors field.
  • Fixed the formatting of output to kMDDisplayName
  • Fixed the calculation of kMDDurationSeconds
  • Added output of "Adium" to kMDItemCreator
  • Added output to kMDItemInstantMessageAddresses (same value as Authors)


* Removed kMDDisplayName entries from schema.xml (Apple says the file should only contain custom fields not defined elsewhere)

  • Added com_adiumX_chatDestinations to schema.xml for xmllog format as a multivalued equivalent of com_adiumX_chatDestination for the htmllog format, which was never set for xmllogs. Added the appropriate entries to the .strings files.
  • Added output to com_adiumX_chatDestinations (same value as Authors, minus the user's account)
  • In Adium's main Info.plist file, under the file association for the xmllog format, changed the value of CFBundleTypeRole from None to Editor. (Since Adium can both save and read the format.) This makes it consistent with the respective value in Adium's htmllog entry, and with iChat's value for its log file format.

Fixes #8160

  Changed 2 years ago by evands

  • milestone changed from Adium X 1.1.5 to Adium X 1.2

follow-up: ↓ 18   Changed 2 years ago by sanmarcos

Was this patch ever applied? I am still getting the issue with 1.2.2. Now they don't even show up sometimes.

in reply to: ↑ 17   Changed 2 years ago by Westacular

The fix was present in 1.2 and all versions since. You may need to tell Spotlight to re-index old logs using the new plugin. To do that, run the following in a terminal:

mdimport -r /Applications/Adium.app/Contents/Library/Spotlight/AdiumSpotlightImporter.mdimporter

  Changed 2 years ago by sanmarcos

That did nothing, none of my logs appear in Spotlight (regardless of the display issue). Do I have to restart or kill a process? or restart spotlight?. Is there a flaw-proof way to see if it indexed them, rather than searching?

follow-up: ↓ 21   Changed 2 years ago by evands

Spotlight in 10.5 doesn't display items in ~/Library... which is where Adium's logs currently are.

in reply to: ↑ 20 ; follow-up: ↓ 22   Changed 2 years ago by sanmarcos

Replying to evands:

Spotlight in 10.5 doesn't display items in ~/Library... which is where Adium's logs currently are.

Are there any plans to fix it? Maybe doing like iChat does by putting it in ~/Documents/?

in reply to: ↑ 21   Changed 2 years ago by Westacular

Spotlight still indexes ~/Library/ files, but the default cmd+space search interface filters out those results,

Doing a search from the cmd+opt+space Spotlight window is one way to avoid that filtering.

More info:  http://www.tuaw.com/2007/11/13/spotlight-in-10-5-skips-over-user-library-files/

  Changed 20 months ago by Robby

  • patch_status changed from Needs Dev Review to Accepted
Note: See TracTickets for help on using tickets.