Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
ad04559c
Commit
ad04559c
authored
19 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
try to create unread_messages table only once when we update config file.
parent
ce0484cc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/check_paths.py
+3
-36
3 additions, 36 deletions
src/common/check_paths.py
src/common/optparser.py
+28
-0
28 additions, 0 deletions
src/common/optparser.py
with
31 additions
and
36 deletions
src/common/check_paths.py
+
3
−
36
View file @
ad04559c
...
...
@@ -35,37 +35,6 @@ Q_ = i18n.Q_
from
pysqlite2
import
dbapi2
as
sqlite
# DO NOT MOVE ABOVE OF import gajim
def
assert_unread_msgs_table_exists
():
'''
create table unread_messages if there is no such table
'''
con
=
sqlite
.
connect
(
logger
.
LOG_DB_PATH
)
cur
=
con
.
cursor
()
needs_init_vars
=
False
try
:
cur
.
executescript
(
'''
CREATE TABLE unread_messages (
message_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
jid_id INTEGER
);
'''
)
con
.
commit
()
needs_init_vars
=
True
except
sqlite
.
OperationalError
,
e
:
pass
# add column jid_id. if there is such column do nothing
try
:
#FIXME: remove before release 0.10, it's temporary
cur
.
executescript
(
'
ALTER TABLE unread_messages ADD jid_id INTEGER;
'
)
con
.
commit
()
needs_init_vars
=
True
except
sqlite
.
OperationalError
,
e
:
pass
if
needs_init_vars
:
gajim
.
logger
.
init_vars
()
con
.
close
()
def
create_log_db
():
print
_
(
'
creating logs database
'
)
con
=
sqlite
.
connect
(
logger
.
LOG_DB_PATH
)
...
...
@@ -126,23 +95,21 @@ def check_and_possibly_create_paths():
print
_
(
'
%s is file but it should be a directory
'
)
%
VCARD_PATH
print
_
(
'
Gajim will now exit
'
)
sys
.
exit
()
if
not
os
.
path
.
exists
(
AVATAR_PATH
):
create_path
(
AVATAR_PATH
)
elif
os
.
path
.
isfile
(
AVATAR_PATH
):
print
_
(
'
%s is file but it should be a directory
'
)
%
AVATAR_PATH
print
_
(
'
Gajim will now exit
'
)
sys
.
exit
()
if
not
os
.
path
.
exists
(
LOG_DB_PATH
):
create_log_db
()
elif
os
.
path
.
isdir
(
LOG_DB_PATH
):
print
_
(
'
%s is directory but should be file
'
)
%
LOG_DB_PATH
print
_
(
'
Gajim will now exit
'
)
sys
.
exit
()
else
:
assert_unread_msgs_table_exists
()
else
:
# dot_gajim doesn't exist
if
dot_gajim
:
# is '' on win9x so avoid that
create_path
(
dot_gajim
)
...
...
This diff is collapsed.
Click to expand it.
src/common/optparser.py
+
28
−
0
View file @
ad04559c
...
...
@@ -193,6 +193,32 @@ class OptionsParser:
gajim
.
config
.
set
(
'
version
'
,
'
0.9
'
)
def
assert_unread_msgs_table_exists
(
self
):
'''
create table unread_messages if there is no such table
'''
import
exceptions
try
:
from
pysqlite2
import
dbapi2
as
sqlite
except
ImportError
:
raise
exceptions
.
PysqliteNotAvailable
import
logger
con
=
sqlite
.
connect
(
logger
.
LOG_DB_PATH
)
cur
=
con
.
cursor
()
try
:
cur
.
executescript
(
'''
CREATE TABLE unread_messages (
message_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
jid_id INTEGER
);
'''
)
con
.
commit
()
logger
.
init_vars
()
except
sqlite
.
OperationalError
,
e
:
pass
con
.
close
()
def
update_config_09_to_010
(
self
):
if
self
.
old_values
.
has_key
(
'
usetabbedchat
'
)
and
not
\
self
.
old_values
[
'
usetabbedchat
'
]:
...
...
@@ -225,5 +251,7 @@ class OptionsParser:
proxies_str
=
'
,
'
.
join
(
proxies
)
gajim
.
config
.
set_per
(
'
accounts
'
,
account
,
'
file_transfer_proxies
'
,
proxies_str
)
# create unread_messages table if needed
self
.
assert_unread_msgs_table_exists
()
gajim
.
config
.
set
(
'
version
'
,
'
0.10
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment