1 ;; emchat-setup.el --- Setup user directory and files for EMchat.
3 ;; Copyright (C) 2002 - 2011 Steve Youngs
5 ;; Author: Steve Youngs <steve@emchat.org>
6 ;; Maintainer: Steve Youngs <steve@emchat.org>
8 ;; Homepage: http://www.emchat.org/
11 ;; This file is part of EMchat.
13 ;; Redistribution and use in source and binary forms, with or without
14 ;; modification, are permitted provided that the following conditions
17 ;; 1. Redistributions of source code must retain the above copyright
18 ;; notice, this list of conditions and the following disclaimer.
20 ;; 2. Redistributions in binary form must reproduce the above copyright
21 ;; notice, this list of conditions and the following disclaimer in the
22 ;; documentation and/or other materials provided with the distribution.
24 ;; 3. Neither the name of the author nor the names of any contributors
25 ;; may be used to endorse or promote products derived from this
26 ;; software without specific prior written permission.
28 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
29 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
38 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 (defconst emchat-world-user-file-template
42 Literally you can put anything you like in this resource file, such as
43 this introduction. EMchat will only consider a line to be a valid buddy
46 -- `:icq' starts at column zero (there's no leading whitespace or
49 -- There is one space between `:icq' and a UIN.
51 -- There is one space between a UIN and a buddy name.
53 -- The buddy name does NOT contain any colon `:' characters.
54 Buddy names can contain whitespace anywhere except as the
57 -- There is one space between the buddy name and any group names.
58 Group names begin with a colon `:'.
64 :icq 88888888 the queen :royalty
66 This way, it defines three buddies: \"emchat\", \"me\", and \"the
67 queen\". It reads alias name until the end of the line, or until the
68 first group name. In that example, the buddy \"the queen\" is in
73 Just change \"12345678 me\" above to your UIN/alias. And don't
74 forget to change the (setq emchat-user-alias \"me\") line in your
75 `user-init-file' to match.
77 BTW, that 1st buddy up there, 34307457 emchat, is a valid UIN, it's
80 Remember to M-x emchat-world-update after changing this rc file.
83 "Template used to create user's initial EMchat rc file.")
86 (defvar emchat-history-directory))
89 (defun emchat-setup ()
90 "Setup your personal EMchat directory.
92 This directory, which defaults to '~/.emchat/', holds the resource file
93 for your ICQ contacts and any log files. It's also a good place to
94 put your sound files."
96 (unless (featurep '(and emchat emchat-history emchat-world emchat-setup))
98 (require 'emchat-history)
99 (require 'emchat-world)
100 (require 'emchat-setup))
101 ;; Create necessary directories.
102 (unless (file-directory-p emchat-directory)
103 (make-directory emchat-directory t))
104 (unless (file-directory-p emchat-sound-directory)
105 (make-directory emchat-sound-directory t))
106 (unless (file-directory-p emchat-history-directory)
107 (make-directory emchat-history-directory t))
108 ;; Create a world file if needed.
109 (unless (file-exists-p emchat-world-rc-filename)
111 (switch-to-buffer (find-file emchat-world-rc-filename))
112 (insert (symbol-value 'emchat-world-user-file-template))
115 (message "Don't forget to edit %s to your requirements"
116 emchat-world-rc-filename))
118 (provide 'emchat-setup)
119 ;;; emchat-setup.el ends here