user default number of messages

Discussion re sg development. You don't have to be a developer.

user default number of messages

Postby josh » Fri Jun 18, 2004 1:38 am

There's been talk of allowing users to set the default number of messages when an address is used without the number:

coyote.spamcowboy@spamgourmet.com

it's currently set to 3.

Here's an idea that wouldn't require changing the database:

Code: Select all
$FEATURES{'DEFAULTNUMMESSAGES'} = 2;

sub getDefaultNumberOfMessages {
  my $features = shift;
  my $num = 0;
  while ($features % $FEATURES{'DEFAULTNUMMESSAGES'} == 0) {
    $features = $features / $FEATURES{'DEFAULTNUMMESSAGES'};
    $num ++;
  }
  $num = 3 if !$num
  return $num;
}


try *that* with a bitmap :) (yes, we'd have to swap out the number 2 for it )
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby SysKoll » Sat Jun 19, 2004 3:25 pm

Josh,

So let me understand: you're storing the options as a power of two factor in the $FEATURE? Holy cow.

This is a great hack, but it's a very CPU-intensive way to get a simple integer!

If we are to add more features, I really, really want a regular set of options instead of a brilliant but hard-to-maintain scheme.
-- SysKoll
SysKoll
 
Posts: 889
Joined: Thu Aug 28, 2003 9:24 pm

Postby maratheamit » Sat Jun 19, 2004 8:24 pm

And a database schema change is nothing to be afraid of. We have a lot of features on the to-do list and some of them will require a schema change. We can try to minimize the number of such releases but if the simplest way to implement a new feature is to add another column to some table, so be it.
maratheamit
 
Posts: 82
Joined: Fri Aug 29, 2003 2:35 pm

Postby josh » Sun Jun 20, 2004 8:20 pm

i know -- more of a joke than anything. I guess maybe we can work on consolidating all the db changes and make one script for it.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron