Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
69c2f618
Commit
69c2f618
authored
Feb 27, 2014
by
vcuculo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support to sound notifications
parent
75194f45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
interface.c
interface.c
+14
-1
interface.h
interface.h
+1
-0
No files found.
interface.c
View file @
69c2f618
...
...
@@ -51,6 +51,7 @@ char *default_prompt = "> ";
int
unread_messages
;
int
msg_num_mode
;
int
alert_sound
;
int
safe_quit
;
...
...
@@ -901,6 +902,7 @@ void interpreter (char *line UU) {
"
\t\t
Level 2: prints line, when somebody is typing in chat
\n
"
"
\t\t
Level 3: prints line, when somebody changes online status
\n
"
"
\t
msg_num - enables/disables numeration of messages
\n
"
"
\t
alert - enables/disables alert sound notifications
\n
"
"chat_with_peer <peer> - starts chat with this peer. Every command after is message to this peer. Type /exit or /quit to end this mode
\n
"
);
pop_color
();
...
...
@@ -1081,6 +1083,8 @@ void interpreter (char *line UU) {
log_level
=
num
;
}
else
if
(
IS_WORD
(
"msg_num"
))
{
msg_num_mode
=
num
;
}
else
if
(
IS_WORD
(
"alert"
))
{
alert_sound
=
num
;
}
}
else
if
(
IS_WORD
(
"chat_with_peer"
))
{
GET_PEER
;
...
...
@@ -1483,6 +1487,9 @@ void print_message (struct message *M) {
}
else
{
printf
(
" »»» "
);
}
if
(
alert_sound
)
{
play_sound
();
}
}
}
else
if
(
get_peer_type
(
M
->
to_id
)
==
PEER_ENCR_CHAT
)
{
peer_t
*
P
=
user_chat_get
(
M
->
to_id
);
...
...
@@ -1516,8 +1523,10 @@ void print_message (struct message *M) {
}
else
{
printf
(
" »»» "
);
}
if
(
alert_sound
)
{
play_sound
();
}
}
}
else
{
assert
(
get_peer_type
(
M
->
to_id
)
==
PEER_CHAT
);
push_color
(
COLOR_MAGENTA
);
...
...
@@ -1558,6 +1567,10 @@ void print_message (struct message *M) {
print_end
();
}
void
play_sound
(
void
)
{
printf
(
"
\a
"
);
}
void
set_interface_callbacks
(
void
)
{
readline_active
=
1
;
rl_callback_handler_install
(
get_default_prompt
(),
interpreter
);
...
...
interface.h
View file @
69c2f618
...
...
@@ -57,6 +57,7 @@ void print_end (void);
void
print_date_full
(
long
t
);
void
print_date
(
long
t
);
void
play_sound
(
void
);
void
update_prompt
(
void
);
void
set_interface_callbacks
(
void
);
#endif
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