Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
171
Issues
171
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
ce1fc18e
Commit
ce1fc18e
authored
Jan 12, 2011
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log messages from normal and private conversations as well
parent
22ad96e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
9 deletions
+14
-9
src/core.py
src/core.py
+2
-0
src/logger.py
src/logger.py
+8
-8
src/room.py
src/room.py
+1
-1
src/tabs.py
src/tabs.py
+3
-0
No files found.
src/core.py
View file @
ce1fc18e
...
...
@@ -519,6 +519,7 @@ class Core(object):
room
.
add_message
(
body
,
time
=
None
,
nickname
=
nick_from
,
colorized
=
False
,
forced_user
=
self
.
get_room_by_name
(
room_from
).
get_user_by_name
(
nick_from
))
logger
.
log_message
(
jid
.
full
.
replace
(
'/'
,
'
\\
'
),
nick_from
,
body
)
self
.
refresh_window
()
self
.
doupdate
()
...
...
@@ -548,6 +549,7 @@ class Core(object):
else
:
remote_nick
=
jid
.
user
conversation
.
get_room
().
add_message
(
body
,
None
,
remote_nick
,
False
,
theme
.
COLOR_REMOTE_USER
)
logger
.
log_message
(
jid
.
bare
,
remote_nick
,
body
)
if
self
.
current_tab
()
is
not
conversation
:
conversation
.
set_color_state
(
theme
.
COLOR_TAB_PRIVATE
)
self
.
refresh_window
()
...
...
src/logger.py
View file @
ce1fc18e
...
...
@@ -34,10 +34,10 @@ class Logger(object):
def
__init__
(
self
):
self
.
logfile
=
config
.
get
(
'logfile'
,
'logs'
)
# a dict of 'groupchatname': file-object (opened)
self
.
groupchat_
fds
=
dict
()
self
.
fds
=
dict
()
def
__del__
(
self
):
for
opened_file
in
self
.
groupchat_
fds
.
values
():
for
opened_file
in
self
.
fds
.
values
():
opened_file
.
close
()
def
check_and_create_log_dir
(
self
,
room
):
...
...
@@ -54,19 +54,19 @@ class Logger(object):
pass
try
:
fd
=
open
(
os
.
path
.
join
(
directory
,
room
),
'a'
)
self
.
groupchat_
fds
[
room
]
=
fd
self
.
fds
[
room
]
=
fd
return
fd
except
IOError
:
return
None
def
groupchat
(
self
,
room
,
nick
,
msg
):
def
log_message
(
self
,
jid
,
nick
,
msg
):
"""
log the message in the appropriate
room
's file
log the message in the appropriate
jid
's file
"""
if
room
in
self
.
groupchat_
fds
.
keys
():
fd
=
self
.
groupchat_fds
[
room
]
if
jid
in
self
.
fds
.
keys
():
fd
=
self
.
fds
[
jid
]
else
:
fd
=
self
.
check_and_create_log_dir
(
room
)
fd
=
self
.
check_and_create_log_dir
(
jid
)
if
not
fd
:
return
if
nick
:
...
...
src/room.py
View file @
ce1fc18e
...
...
@@ -52,7 +52,7 @@ class Room(TextBuffer):
to be
"""
if
time
is
None
and
self
.
joined
:
# don't log the history messages
logger
.
groupchat
(
self
.
name
,
nickname
,
txt
)
logger
.
log_message
(
self
.
name
,
nickname
,
txt
)
def
do_highlight
(
self
,
txt
,
time
,
nickname
):
"""
...
...
src/tabs.py
View file @
ce1fc18e
...
...
@@ -43,6 +43,7 @@ from sleekxmpp.xmlstream.stanzabase import JID
from
config
import
config
from
roster
import
RosterGroup
,
roster
from
contact
import
Contact
,
Resource
from
logger
import
logger
import
multiuserchat
as
muc
class
Tab
(
object
):
...
...
@@ -655,6 +656,7 @@ class PrivateTab(ChatTab):
def
command_say
(
self
,
line
):
muc
.
send_private_message
(
self
.
core
.
xmpp
,
self
.
get_name
(),
line
)
self
.
core
.
add_message_to_text_buffer
(
self
.
get_room
(),
line
,
None
,
self
.
get_room
().
own_nick
)
logger
.
log_message
(
self
.
get_name
().
replace
(
'/'
,
'
\\
'
),
self
.
get_room
().
own_nick
,
line
)
def
command_unquery
(
self
,
arg
):
"""
...
...
@@ -1034,6 +1036,7 @@ class ConversationTab(ChatTab):
def
command_say
(
self
,
line
):
muc
.
send_private_message
(
self
.
core
.
xmpp
,
self
.
get_name
(),
line
)
self
.
core
.
add_message_to_text_buffer
(
self
.
get_room
(),
line
,
None
,
self
.
core
.
own_nick
)
logger
.
log_message
(
JID
(
self
.
get_name
()).
bare
,
self
.
core
.
own_nick
,
line
)
def
command_unquery
(
self
,
arg
):
self
.
core
.
close_tab
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment