Re: Newmail plugin: Set a default and relative path in prefs?

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

 



> I did add the newmail plugin to my SquirrelMail setup and it worked fine
> at once. Many thanks to the author. 
> 
> Then I tried to change the default: I wanted to enable a "new mail" sound
> to be effective for all users, but did not find out how to do that.
> Users shall be able to choose their own "newmail" setting, but I want to
> control the default for all users who don't change anything.
> 
> It's possible to achieve that with forced_prefs plugin (added_settings),
> but that's not quite the way I'd like to do that, because forced_prefs
> writes the setting to the user prefs as soon as they log in, and any
> further changes to my default wouldn't affect them.

There are four types of user preferences.
1. Default SquirrelMail values. (no setting in prefs)
2. Configuration values selected by end user (setting is stored in prefs and
user can change it)
3. Configuration values selected by admin (setting is stored in prefs and user
can change it)
4. Configuration values enforced by admin (setting is stored in prefs and user
can't change it)

Difference between 2 and 3 is very small and code can't determine if setting is
selected by admin or by end user.

forced_prefs plugin might be able to operate with preference cache and does not
have to save settings in preference files, but I don't have plans to implement
it. Such code is unstable and highly dependent on preference backend
implementation. There are no standards in SquirrelMail preference cache
implementation and plugin would break on any non-standard prefs setup. Forced
Prefs plugin is designed to be simple and failsafe.

> I tried to add my designated default to load_prefs.php - but it does not
> work like this:
> 
> $newmail_enable = getPref($data_dir, $username, 'newmail_enable', 'on');
> $newmail_media = getPref($data_dir, $username, 'newmail_media',
'http://server/squirrelmail/plugins/newmail/sounds/yougotmail.wav');
> 
> What is the right way?

Your changes in SquirrelMail include/load_prefs.php won't work. Newmail plugin
settings are not corified. Default newmail values are loaded in loading_prefs
hook and this hook is executed after other code in include/load_prefs.php is
executed.

If you want to modify newmail plugin defaults in 1.4.x, check
plugins/newmail/setup.php file, newmail_pref function.

> Something else that I mulled over after I found out how newmail writes
> the settings to the user prefs files: Like above, it writes the full path
> for the sound. I am not certain if that is good.
>
> In my setup, SquirrelMail is to be used in a LAN only and the users can
> just enter the name of the server's computer (i.e. "server") to get the
> index page, or "server/squirrelmail" to start SquirrelMail.
> Works fine with Firefox on Windows, but for a reason unknown to me,
> Firefox on Linux can't access the server by its name - it will start a
> web search for "server" instead.

man 5 hosts
man 5 resolv.conf
man 5 nsswitch.conf

Windows machines use netbios network names in name resolution. Linux machines
don't do that by default. Put server's ip to hostname mapping in /etc/hosts or
fix DNS search suffix in /etc/resolv.conf. Make sure that 'ping server' command
works.

Linux starts search for 'server' because name is not resolved.
.
> So the IP address has to be used to
> get to the server and to SquirrelMail, and the absolute path stored in
> user prefs would not work in theory, but for another reason unknown to
> me, it works fine and the sound is played.
> 
> However, if we should choose to allow access to SquirrelMail from outside
> the LAN (the Internet!), neither the server name nor the local IP address
> can possibly work for the soundfile URL. Similar problem if we change the
> server's name or move SquirrelMail to another computer.
> ???

Full path is used only in 1.4.x. 1.5.1+ uses basename. If you use 1.4.6 or
newer, saved path does not matter. Plugin always recalculates path to current
base url.

----
plugins/newmail/setup.php
----
Revision 1.17.2.8
Sun Nov 6 09:31:00 2005 UTC (16 months, 2 weeks ago) by tokul
Branch: SM-1_4-STABLE
Changes since 1.17.2.7: +15 -3 lines

Rebuild URL to played sound (#1233530). Using simple fix in order to reduce
number of changes introduced in stable.
----


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives:  http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux