Re: [Standards] Comments on SIFT

2010-03-10 Thread Jack Moffitt
 With per-message filtering this changes to something like this:

  3. loop over the resultset and send all _allowed_ messages to the
 newly available resource
  4. for each sent message, DELETE FROM offline_messages WHERE JID ==
 ${account_jid} and MESSAGEID == $(unique_message_id)

 This could be optimized somewhat, but would still be relatively complex.

This is a non-issue. The problem here is how expensive it is to find
each message to delete, but you have a list of IDs. You can avoid all
the overhead of multiple queries by sending a single SQL statement:

DELETE FROM offline_messages WHERE jid == ${account_id} and message_id
IN (@unique_message_ids)

This should probably be more efficient than the non-allow case,
because there are less messages to delete than the full list.

jack.


[Standards] Comments on SIFT

2010-03-06 Thread Waqas Hussain
While implementing mod_sift for Prosody, I saw some possibilities for
improvement and had thoughts about issues. Some of these follow.


1. Remove disallowed child elements for filtered messages and presence.

Here's a typical identi.ca message:

  message from=upd...@identi.ca/xmpp001daemon to=wa...@jaim.at type=chat
  bodyevan: RT @sil doom. the Shuttle computer I'm setting up for
dad can't read the hard drive. Won't boot from USB, has no CD drive, I
have no USB ... [23931040]/body
  html xmlns=http://jabber.org/protocol/xhtml-im;
  body xmlns=http://www.w3.org/1999/xhtml;
  : RT @doom. the Shuttle computer I'm setting up for dad can't read
the hard drive. Won't boot from USB, has no CD drive, I have no USB
...
  a href=http://identi.ca/evan;evan/a
  span class=vcard
  a title=Stuart Langridge class=url href=http://identi.ca/user/279;
  span class=fn nicknamesil/span
  /a
  /span
  a 
href=http://identi.ca/conversation/24011046#notice-23931040;[23931040]/a
  /body
  /html
  entry xmlns=http://www.w3.org/2005/Atom;
  source
  titleevan - Identi.ca/title
  link href=http://identi.ca/evan; /
  link rel=self type=application/atom+xml href=http://identi.ca/evan; /
  link rel=license href=http://creativecommons.org/licenses/by/3.0/; /
  iconhttp://avatar.identi.ca/1-96-20090819204503.jpeg/icon
  /source
  titleRT @sil doom. the Shuttle computer I'm setting up for dad
can't read the hard drive. Won't boot from USB, has no CD drive, I
have no USB .../title
  author
  nameevan/name
  urihttp://identi.ca/user/1/uri
  /author
  actor xmlns=http://activitystrea.ms/spec/1.0/;
  object-typehttp://activitystrea.ms/schema/1.0/person/object-type
  id xmlns=http://www.w3.org/2005/Atom;http://identi.ca/user/1/id
  title xmlns=http://www.w3.org/2005/Atom;Evan Prodromou/title
  link rel=alternate type=text/html href=http://identi.ca/evan;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=353
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=353
href=http://avatar.identi.ca/1-353-20090819204502.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=96
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=96
href=http://avatar.identi.ca/1-96-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=48
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=48
href=http://avatar.identi.ca/1-48-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=24
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=24
href=http://avatar.identi.ca/1-24-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  point xmlns=http://www.georss.org/georss;45.5088375 -73.587809/point
  preferredUsername
xmlns=http://portablecontacts.net/spec/1.0;evan/preferredUsername
  displayName xmlns=http://portablecontacts.net/spec/1.0;Evan
Prodromou/displayName
  note xmlns=http://portablecontacts.net/spec/1.0;Montreal hacker
and entrepreneur. Founder of identi.ca, lead developer of StatusNet,
CEO of StatusNet Inc./note
  address xmlns=http://portablecontacts.net/spec/1.0;
  formattedMontreal, Quebec, Canada/formatted
  /address
  urls xmlns=http://portablecontacts.net/spec/1.0;
  typehomepage/type
  valuehttp://evan.prodromou.name//value
  primarytrue/primary
  /urls
  /actor
  link rel=alternate type=text/html
href=http://identi.ca/notice/23931040; /
  idhttp://identi.ca/notice/23931040/id
  published2010-03-06T20:01:22+00:00/published
  updated2010-03-06T20:01:22+00:00/updated
  link rel=ostatus:conversation
href=http://identi.ca/conversation/24011046; /
  forward ref=http://identi.ca/notice/23928915;
href=http://identi.ca/notice/23928915;
xmlns=http://ostatus.org/schema/1.0; /
  content type=htmlRT @span class=vcarda
href=http://identi.ca/user/279; class=url title=Stuart
Langridgespan class=fn nicknamesil/span/a/span doom. the
Shuttle computer I'm setting up for dad can't read the hard drive.
Won't boot from USB, has no CD drive, I have no USB .../content
  /entry
  /message

Look at the size of that. Should I laugh or cry?  This should be reduced to:

  message from=upd...@identi.ca/xmpp001daemon to=wa...@jaim.at type=chat
  bodyevan: RT @sil doom. the Shuttle computer I'm setting up for
dad can't read the hard drive. Won't boot from USB, has no CD drive, I
have no USB ... [23931040]/body
  /message

for mobile clients. That's roughly 6% of the original (~4,257 bytes
reduced to ~262 bytes). I think without this behavior, message
filtering is pretty useless.

Useless fact: Watching offline messages from identi.ca using up
bandwidth in slow motion (slow, expensive GPRS with payment based on
bandwidth usage) is what got mod_sift for Prosody started.


2. Offline messages.

A SIFT 

Re: [Standards] Comments on SIFT

2010-03-06 Thread Jason

interesting - I've built a variation on this for offline messages,
but allowing quite complex allow criteria. I couldnt make xmpp do it 
(I'm not saying xmpp couldnt, but just that I couldnt figure out how) as 
my case seemed to require altered routing rules and a few other issues 
surrounding my frequent, but momentary presence requirement, so I ended 
up just using xmpp as a transport.


Cheers.



Waqas Hussain wrote:

While implementing mod_sift for Prosody, I saw some possibilities for
improvement and had thoughts about issues. Some of these follow.


1. Remove disallowed child elements for filtered messages and presence.

Here's a typical identi.ca message:

  message from=upd...@identi.ca/xmpp001daemon to=wa...@jaim.at type=chat
  bodyevan: RT @sil doom. the Shuttle computer I'm setting up for
dad can't read the hard drive. Won't boot from USB, has no CD drive, I
have no USB ... [23931040]/body
  html xmlns=http://jabber.org/protocol/xhtml-im;
  body xmlns=http://www.w3.org/1999/xhtml;
  : RT @doom. the Shuttle computer I'm setting up for dad can't read
the hard drive. Won't boot from USB, has no CD drive, I have no USB
...
  a href=http://identi.ca/evan;evan/a
  span class=vcard
  a title=Stuart Langridge class=url href=http://identi.ca/user/279;
  span class=fn nicknamesil/span
  /a
  /span
  a 
href=http://identi.ca/conversation/24011046#notice-23931040;[23931040]/a
  /body
  /html
  entry xmlns=http://www.w3.org/2005/Atom;
  source
  titleevan - Identi.ca/title
  link href=http://identi.ca/evan; /
  link rel=self type=application/atom+xml href=http://identi.ca/evan; /
  link rel=license href=http://creativecommons.org/licenses/by/3.0/; /
  iconhttp://avatar.identi.ca/1-96-20090819204503.jpeg/icon
  /source
  titleRT @sil doom. the Shuttle computer I'm setting up for dad
can't read the hard drive. Won't boot from USB, has no CD drive, I
have no USB .../title
  author
  nameevan/name
  urihttp://identi.ca/user/1/uri
  /author
  actor xmlns=http://activitystrea.ms/spec/1.0/;
  object-typehttp://activitystrea.ms/schema/1.0/person/object-type
  id xmlns=http://www.w3.org/2005/Atom;http://identi.ca/user/1/id
  title xmlns=http://www.w3.org/2005/Atom;Evan Prodromou/title
  link rel=alternate type=text/html href=http://identi.ca/evan;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=353
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=353
href=http://avatar.identi.ca/1-353-20090819204502.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=96
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=96
href=http://avatar.identi.ca/1-96-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=48
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=48
href=http://avatar.identi.ca/1-48-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  link rel=avatar type=image/jpeg
xmlns:ns1=http://purl.org/syndication/atommedia; ns1:height=24
xmlns:ns2=http://purl.org/syndication/atommedia; ns2:width=24
href=http://avatar.identi.ca/1-24-20090819204503.jpeg;
xmlns=http://www.w3.org/2005/Atom; /
  point xmlns=http://www.georss.org/georss;45.5088375 -73.587809/point
  preferredUsername
xmlns=http://portablecontacts.net/spec/1.0;evan/preferredUsername
  displayName xmlns=http://portablecontacts.net/spec/1.0;Evan
Prodromou/displayName
  note xmlns=http://portablecontacts.net/spec/1.0;Montreal hacker
and entrepreneur. Founder of identi.ca, lead developer of StatusNet,
CEO of StatusNet Inc./note
  address xmlns=http://portablecontacts.net/spec/1.0;
  formattedMontreal, Quebec, Canada/formatted
  /address
  urls xmlns=http://portablecontacts.net/spec/1.0;
  typehomepage/type
  valuehttp://evan.prodromou.name//value
  primarytrue/primary
  /urls
  /actor
  link rel=alternate type=text/html
href=http://identi.ca/notice/23931040; /
  idhttp://identi.ca/notice/23931040/id
  published2010-03-06T20:01:22+00:00/published
  updated2010-03-06T20:01:22+00:00/updated
  link rel=ostatus:conversation
href=http://identi.ca/conversation/24011046; /
  forward ref=http://identi.ca/notice/23928915;
href=http://identi.ca/notice/23928915;
xmlns=http://ostatus.org/schema/1.0; /
  content type=htmlRT @span class=vcarda
href=http://identi.ca/user/279; class=url title=Stuart
Langridgespan class=fn nicknamesil/span/a/span doom. the
Shuttle computer I'm setting up for dad can't read the hard drive.
Won't boot from USB, has no CD drive, I have no USB .../content
  /entry
  /message

Look at the size of that. Should I laugh or cry?  This should be reduced to:

  message from=upd...@identi.ca/xmpp001daemon to=wa...@jaim.at type=chat
  bodyevan: RT @sil doom. the Shuttle computer I'm setting up for
dad can't read the hard drive. Won't boot from USB, has no CD drive, I
have