~amsn-daily/amsn/amsn-packaging

« back to all changes in this revision

Viewing changes to AppMain.tcl

  • Committer: germinator2000
  • Date: 2003-12-29 19:02:29 UTC
  • Revision ID: svn-v4:f248a3e1-9e13-0410-b2cf-a4429de6d898:trunk/amsn:1629
Mac OS X Wrapper for source file aMSN

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env wish
2
 
###AppMain.tcl is an exact copy of the file aMSN
3
 
###This is necessary on Mac OS X to have the excute file named "Appmain.tcl" with TCl-TK
4
 
###Added by Germinator2000 (Jerome Gagnon-Voyer) ask on Mailing list amsn-dev for others questions
5
 
################################################################
6
 
###                                              ###############
7
 
###        Alvaro's Messenger - amsn             ###############
8
 
###                                              ###############
9
 
###       http://amsn.sourceforge.net            ###############
10
 
###     amsn-users@lists.sourceforge.net         ###############
11
 
###                                              ###############
12
 
################################################################
13
 
### airadier at users.sourceforge.net (airadier) ###############
14
 
### Universidad de Zaragoza                      ###############
15
 
### http://aim.homelinux.com                     ###############
16
 
################################################################
17
 
### grimaldo@panama.iaehv.nl (LordOfScripts)     ###############
18
 
### http://www.coralys.com/linux/                ###############
19
 
################################################################
20
 
### Original ccmsn                               ###############
21
 
### http://msn.CompuCreations.com/               ###############
22
 
### Dave Mifsud <dave at CompuCreations dot com> ###############
23
 
################################################################
24
 
###
25
 
###
26
 
### This program is free software; you can redistribute it and/or modify
27
 
### it under the terms of the GNU General Public License as published by
28
 
### the Free Software Foundation; version 2 of the License
29
 
###
30
 
### This program is distributed in the hope that it will be useful,
31
 
### but WITHOUT ANY WARRANTY; without even the implied warranty of
32
 
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33
 
### GNU General Public License for more details.
34
 
###
35
 
### You should have received a copy of the GNU General Public License
36
 
### along with this program; if not, write to the Free Software
37
 
### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38
 
###
39
 
###
40
 
 
41
 
 
42
 
############################################################
43
 
### Some global variables
44
 
############################################################
45
 
set version "0.90beta"
46
 
set date "12/13/2003"
47
 
set weburl "http://amsn.sourceforge.net"
48
 
set program_dir ""
49
 
set HOME ""
50
 
set files_dir ""
51
 
 
52
 
#=======================================================================
53
 
 
54
 
 
55
 
############################################################
56
 
### Look if we are launched from a link
57
 
### and set the correct working dir
58
 
############################################################
59
 
 
60
 
#Fixed by Tomasz Nguyen
 
2
# MacOS X AMSN wrapper 
 
3
 
 
4
#Set variable program_dir
61
5
set program_dir [file dirname [info script]]
62
6
set program [file tail [info script]]
63
7
 
72
16
}
73
17
 
74
18
unset program
75
 
 
76
 
 
77
 
############################################################
78
 
### Setup other important directory paths
79
 
### depending on the platform
80
 
############################################################
81
 
 
82
 
if {$tcl_platform(platform) == "unix"} {
83
 
   set HOME "[file join $env(HOME) .amsn]"
84
 
   set files_dir "[file join $env(HOME) amsn_received]"
85
 
} elseif {$tcl_platform(platform) == "windows"} {
86
 
  if {[info exists env(USERPROFILE)]} {
87
 
     set HOME "[file join $env(USERPROFILE) amsn]"
88
 
     set files_dir "[file join $env(USERPROFILE) amsn_received]"
89
 
  } else {
90
 
   set HOME "[file join [pwd] amsn_config]"
91
 
   set files_dir "[file join [pwd] amsn_received]"
92
 
  }
93
 
} else {
94
 
   set HOME "[file join [pwd] amsn_config]"
95
 
   set files_dir "[file join [pwd] amsn_received]"
96
 
}
97
 
 
98
 
############################################################
99
 
### And setup where to find optional packages
100
 
############################################################
101
 
 
102
 
lappend auto_path "[file join $program_dir plugins]"
103
 
lappend auto_path "[file join ${HOME} plugins]"
104
 
 
105
 
 
106
 
set libtls ""
107
 
 
108
 
catch { source [file join $HOME tlsconfig.tcl] }
109
 
 
110
 
if { $libtls != "" && [lsearch $auto_path $libtls] == -1 } {
111
 
    lappend auto_path $libtls
112
 
}
113
 
 
114
 
#TODO: Move this from here ??
115
 
#///////////////////////////////////////////////////////////////////////
116
 
#Notebook Pages (Buddies,News,Calendar,etc.)
117
 
set pgBuddy ""
118
 
set pgNews  ""
119
 
#///////////////////////////////////////////////////////////////////////
120
 
 
121
 
 
122
 
############################################################
123
 
#### Load program modules
124
 
############################################################
125
 
set initialize_amsn 1
126
 
 
127
 
 
128
 
 
129
 
proc reload_files { } {
130
 
    foreach glob "[info globals] xmms" {
131
 
        global $glob
132
 
    }
133
 
 
134
 
    source [file join $program_dir ctthemes.tcl]
135
 
    source [file join $program_dir notebook.tcl]        ;# Notebook Megawidget
136
 
    #source [file join $program_dir notebook1.tcl]      ;# Notebook Megawidget
137
 
    source [file join $program_dir rnotebook.tcl]       ;# Notebook Megawidget
138
 
    source [file join $program_dir progressbar.tcl]     ;# Progressbar Megawidget
139
 
    source [file join $program_dir dkffont.tcl] ;# Font selection megawidget
140
 
    source [file join $program_dir migmd5.tcl]
141
 
    source [file join $program_dir des.tcl]             ;# DES encryption
142
 
    source [file join $program_dir sxml.tcl]    ;# Simple XML parser
143
 
    source [file join $program_dir lang.tcl]
144
 
    source [file join $program_dir automsg.tcl]
145
 
    source [file join $program_dir smileys.tcl]
146
 
    source [file join $program_dir skins.tcl]       ;# Used for skinning purposes
147
 
    source [file join $program_dir config.tcl]
148
 
    source [file join $program_dir proxy.tcl]
149
 
    source [file join $program_dir protocol.tcl]
150
 
    source [file join $program_dir ctadverts.tcl]
151
 
    source [file join $program_dir ctdegt.tcl]
152
 
    source [file join $program_dir hotmail.tcl]
153
 
    source [file join $program_dir groups.tcl]  ;# Handle buddy groups
154
 
    source [file join $program_dir abook.tcl]   ;# Handle buddy address book
155
 
    source [file join $program_dir anigif.tcl]  ;# Animated GIFS
156
 
    if {$tcl_platform(platform) == "unix"} {
157
 
     source [file join $program_dir xmms.tcl]
158
 
    }
159
 
    source [file join $program_dir gui.tcl]
160
 
    source [file join $program_dir alarm.tcl]   ;# Alarms code (Burger)
161
 
    source [file join $program_dir dock.tcl]    ;# Docking routines
162
 
    source [file join $program_dir trayicon.tcl]        ;# Docking routines for freedesktop system tray compliant docks
163
 
    source [file join $program_dir loging.tcl]  ;# Euh yeh it's for loging :P
164
 
    source [file join $program_dir combobox.tcl]        ;# The all mighty combobox is here! (B. Oakley)
165
 
    source [file join $program_dir blocking.tcl]    ;# The blocking users feature
166
 
    source [file join $program_dir remote.tcl  ]    ;# The remote control procedures
167
 
    source [file join $program_dir plugins.tcl] ;# Plugins system
168
 
    source [file join $program_dir balloon.tcl]       ;# For the balloons tooltip
169
 
    source [file join $program_dir png.tcl]       ;# PNG Parser and zlib deflate in pure TCL (KaKaRoTo)
170
 
 
171
 
    load_lang
172
 
}
173
 
 
174
 
proc check_imagemagick {} {
175
 
        global config
176
 
        
177
 
        # Check if ImageMagick is Installed, if so dont do nothing, otherwise disable display pics
178
 
        status_log "Checking ImageMagick...\n"
179
 
        if { [catch { exec convert } res] } {
180
 
                if {$config(getdisppic) == 1 } {
181
 
                        msg_box "[trans installconvert]"
182
 
                        status_log "ImageMagick not installed got error $res\n Disabling display pictures\n"
183
 
                }
184
 
                #-1 means you want them enabled, but imagemagic is not installed...
185
 
                set config(getdisppic) -1
186
 
        } else {
187
 
                set config(getdisppic) 1
188
 
        }
189
 
}
190
 
 
191
 
proc check_imagemagick2 {} {
192
 
        global config
193
 
        
194
 
        # Check if ImageMagick is Installed, if so dont do nothing, otherwise disable display pics
195
 
        status_log "Checking ImageMagick...\n"
196
 
        if { [catch { exec /usr/local/bin/convert } res] } {
197
 
                if {$config(getdisppic) == 1 } {
198
 
                        msg_box "[trans installconvert]"
199
 
                        status_log "ImageMagick not installed got error $res\n Disabling display pictures\n"
200
 
                }
201
 
                #-1 means you want them enabled, but imagemagic is not installed...
202
 
                set config(getdisppic) -1
203
 
        } else {
204
 
                set config(getdisppic) 1
205
 
        }
206
 
}
207
 
 
208
 
reload_files
209
 
 
210
 
set initialize_amsn 0
211
 
#///////////////////////////////////////////////////////////////////////
212
 
 
213
 
if { [catch {package require tls}] } {
214
 
    # Either tls is not installed, or $auto_path does not point to it.
215
 
    # Should now never happen; the check for the presence of tls is made
216
 
    # before this point.
217
 
#    status_log "Could not find the package tls on this system.\n"
218
 
    set tlsinstalled 0
219
 
} else {
220
 
    set tlsinstalled 1
221
 
}
222
 
 
223
 
 
224
 
#create_dir $HOME
225
 
set log_dir "[file join ${HOME} logs]"
226
 
#create_dir $log_dir
227
 
 
228
 
sb set ns name ns
229
 
sb set ns sock ""
230
 
sb set ns data [list]
231
 
sb set ns serv [split $config(start_ns_server) ":"]
232
 
sb set ns stat "d"
233
 
 
234
 
set family [lindex $config(basefont) 0]
235
 
set size [lindex $config(basefont) 1]
236
 
 
237
 
::themes::Init
238
 
degt_Init
239
 
if { $family == "" } { set family "Helvetica"}
240
 
if { $size == "" } { set size "11"}
241
 
::amsn::initLook $family $size $config(backgroundcolor)
242
 
 
243
 
 
244
 
if { $config(encoding) != "auto" } {
245
 
  set_encoding $config(encoding)
246
 
}
247
 
 
248
 
if { $config(receiveddir) != "" } {
249
 
   set res [create_dir $config(receiveddir)]
250
 
   if { $res >= 0} {
251
 
      set files_dir $config(receiveddir)
252
 
   } else {
253
 
      create_dir $files_dir
254
 
   }
255
 
} else {
256
 
        set config(receiveddir) $files_dir
257
 
        create_dir $files_dir
258
 
}
259
 
 
260
 
cmsn_draw_main
261
 
 
262
 
bind all <KeyPress> "set idletime 0"
263
 
 
264
 
idleCheck
265
 
 
266
 
degt_protocol_win
267
 
degt_ns_command_win
268
 
 
269
 
after 500 proc_ns
270
 
after 750 proc_sb
271
 
 
272
 
 
273
 
if {$tcl_platform(os) == "Darwin"} {
274
 
if { $config(getdisppic) != 0 } {
275
 
        check_imagemagick2
276
 
}
277
 
} else { 
278
 
if { $config(getdisppic) != 0 } {
279
 
        check_imagemagick
280
 
}
281
 
}
282
 
 
283
 
 
284
 
 
285
 
 
286
 
if {$version != $config(last_client_version)} {
287
 
   ::amsn::aboutWindow
288
 
 
289
 
}
290
 
 
291
 
if { $config(autoconnect) == 1 } {
292
 
  ::MSN::connect $config(login) password
293
 
}
294
 
 
295
 
if { $config(autocheckver) == 1 } {
296
 
    set new [check_version_silent]
297
 
}
298
 
 
299
 
# BeginVerifyBlocked
300
 
init_remote_DS
301
 
init_dock
302
 
 
303
 
if {$config(startontray)} {
304
 
        if {$config(dock)!=0} {
305
 
                wm state . withdraw
306
 
        } else {
307
 
                wm state . iconic
308
 
        }
309
 
} else {
310
 
        wm state . normal
311
 
}
 
19
#Source the main file, amsn
 
20
source [file join $program_dir amsn]
 
 
b'\\ No newline at end of file'