Re: Dashboard frontend status?



Hey,

Attached is a hack of something along the lines. This could be quite
easy to implement in Dashboard. The only problem is that it relies on
your Evolution address book to have useful info for querying.

Best,
Lukas

On Tue, 2005-11-01 at 00:53 -0500, Nat Friedman wrote:
> On Mon, 2005-10-31 at 21:00 -0800, Alex Graveley wrote:
> > Hi,
> > 
> > Does anyone know anything of the current status regarding the various 
> > dashboard frontend patches/plugins?  As in, do they still work at all?
> 
> Most have bitrotted, including Gaim and Evolution.  A few of them are
> actually in vitro and probably still work, like the Abiword plugin.  
> 
> In the last few months I've several times started writing a simple
> rules-based expert-system like Dashboard on a per-task basis, using your
> focus-tracking code and some of those frontend patches.  No
> cluechaining, no magic ranking, just simple rules like:
>         
>         When I'm reading email, show
>         
>                 - other unread emails from the sender
>                 - recent emails sent to the sender
>                 - recent IM conversations with the sender
>                 - recent blog entries from the sender
>                 - highly-relevant recently viewed web pages related to
>                 the email body
>                 - highly-relevant recently viewed documents related to
>                 the email body
>         
>         When I'm browsing the web, show
>         
>                 - highly-relevant recently viewed documents related to
>                 the page content
>                 .
>                 .
>                 .
> 
> Etc.
> 
> I don't know if you're interested in reviving Dashboard, but if I were
> to do it now, that's how I'd start.
> 
> Nat
> 
> 
> _______________________________________________
> Dashboard-hackers mailing list
> Dashboard-hackers gnome org
> http://mail.gnome.org/mailman/listinfo/dashboard-hackers
> 
//
// Booha.cs - a super leet tool
//
//
// Copyright (c) 2005, Lukas Lipka <lukas pmad net>
//
using System;
using System.Collections;
using Beagle;

public class BeagleQuery {
	
	private Query query;
	private bool finished = false;
	private ArrayList hits = new ArrayList ();

	public string Text;
	public string HitType;
	public string MimeType;

	public BeagleQuery ()
	{
		query = new Query ();
		query.AddDomain (QueryDomain.Neighborhood);
		query.Keepalive = false;
	}

	public ArrayList Search ()
	{
		query.HitsAddedEvent += OnHitsAdded;
		query.FinishedEvent += OnFinished;
		query.CancelledEvent += OnCancelled;
		
		if (HitType != null && HitType != "")
			query.AddHitType (HitType);

		if (MimeType != null && MimeType != "")
			query.AddMimeType (MimeType);

		query.SendAsyncBlocking ();

		return hits;
	}

	public void AddText (string text)
	{
		Text = text;
		query.AddText (text);
	}

	public void AddPropertyKeyword (string key, string value)
	{
		QueryPart_Property p = new QueryPart_Property ();
		p.Type = PropertyType.Keyword;
		p.Key = key;
		p.Value = value;

		query.AddPart (p);
	}

	public void AddPropertyText (string key, string value)
	{
		QueryPart_Property p = new QueryPart_Property ();
		p.Type = PropertyType.Text;
		p.Key = key;
		p.Value = value;

		query.AddPart (p);
	}
	
	private void OnHitsAdded (HitsAddedResponse response)
	{
		foreach (Hit hit in response.Hits) {
			hits.Add (hit);
			Console.WriteLine ("+ {0}", hit.Uri);
		}
	}

	private void OnFinished (FinishedResponse repsonse)
	{
		query.Close ();
	}
	
	private void OnCancelled (CancelledResponse response)
	{
		Console.WriteLine ("Cancelled");
		query.Close ();
	}
}

///////////////////////////////////////////////////////////////
// Object classes
///////////////////////////////////////////////////////////////
public class Contact {

	// FIXME: Bind more properties

	public string Name;
	public string FamilyName;
	public string Nickname;

	public ArrayList Email = new ArrayList ();
	public ArrayList Im = new ArrayList ();

	public string Webpage;

	public Contact (Hit hit)
	{
		Name = hit ["fixme:FileAs"];
		FamilyName = hit ["fixme:FamilyName"];
		Nickname = hit ["fixme:Nickname"];

		AddEmail (hit ["fixme:Email1"]);
		AddEmail (hit ["fixme:Email2"]);
		AddEmail (hit ["fixme:Email3"]);

		AddIm (hit.GetProperties ("fixme:ImAim"));
		AddIm (hit.GetProperties ("fixme:ImMsn"));
		AddIm (hit.GetProperties ("fixme:ImIcq"));
		AddIm (hit.GetProperties ("fixme:ImJabber"));
		AddIm (hit.GetProperties ("fixme:ImYahoo"));
		AddIm (hit.GetProperties ("fixme:ImGroupwise"));
	}

	private void AddEmail (string s)
	{
		if (s != null && s != "")
			Email.Add (s);
	}

	private void AddIm (string [] im)
	{
		if (im == null || im.Length < 1)
			return;

		foreach (string s in im)
			if (s != null && s != "")
				Im.Add (s);
	}
}

///////////////////////////////////////////////////////////////
// Driver
///////////////////////////////////////////////////////////////
public class Driver {

	private static string Email;
	private static string Subject;

	private static void PrintUsageAndExit ()
	{
		Console.WriteLine ("\t--email <address>\tThe address of the contact");
		Console.WriteLine ("\t--subject [subject]\tSubject of the email");

		Environment.Exit (0);
	}

	private static void ParseArgs (string [] args)
	{
		int i = 0;
		
		while (i < args.Length) {
			switch (args [i]) {
			case "--email":
				Email = args [i + 1];
				i++;
				break;
				
			case "--subject":
				Subject = args [i + 1];
				i++;
				break;
			}

			i++;
		}
	}

	public static void Main (string [] args)
	{
		Console.WriteLine ("Booha - a tool of leetness :-)\n");

		if (args.Length < 1)
			PrintUsageAndExit ();
		
		ParseArgs (args);

		Console.WriteLine ("Email: {0}", Email);

		// 1. Fire of a Contact query, so we can map
		// email addresses, IM's, websites, etc.
		ArrayList contacts = new ArrayList ();

		BeagleQuery query = new BeagleQuery ();
		query.AddPropertyKeyword ("fixme:Email1", Email); //FIXME: Search all Email123
		query.HitType = "Contact";
		ArrayList hits_contacts = query.Search ();

		foreach (Hit hit in hits_contacts) {
			Contact contact = new Contact (hit);
			contacts.Add (contact);			
		}

		Console.WriteLine ("Found {0} contacts!", contacts.Count);

		// 2. Search for IM's
		// FIXME: This is very complicated, many ALs
		//ArrayList logs = new ArrayList ();

		foreach (Contact c in contacts) {
			ArrayList logs = new ArrayList ();

			foreach (string im in c.Im) {
				query = new BeagleQuery ();
				query.HitType = "IMLog";
				query.AddPropertyKeyword ("fixme:speakingto", im);
				ArrayList hits_logs = query.Search ();

				// FIXME: Create new type IM Log
				foreach (Hit hit in hits_logs) {
					logs.Add (hit);
				}
			}
			
			Console.WriteLine ("Found {0} IM logs for contact {1}!", logs.Count, c.Name);
		}

		// 3. Search for recent emails from contact
		ArrayList emails = new ArrayList ();
		
		query = new BeagleQuery ();
		query.AddText (Email);
		//query.AddPropertyKeyword ("fixme:from", Email);
		query.HitType = "MailMessage";
		ArrayList hits_emails = query.Search ();

		Console.WriteLine ("Found {0} emails from {1}", hits_emails.Count, Email);

		// 4. Search for email from contact

		// 5. Search for files related to contact
		ArrayList files = new ArrayList ();

		// FIXME: Searches only for files with
		// email address in them		
		query = new BeagleQuery ();
		query.AddText (Email);
		//query.AddText () //FIXME: OR query, contact name
		query.HitType = "File";
		ArrayList hits_files = query.Search ();

		Console.WriteLine ("Found {0} files related to {1}", hits_files.Count, Email);
	}
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]