[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] align message and text priorities in server with a client li
From: |
Andrei Kholodnyi |
Subject: |
[PATCH 2/4] align message and text priorities in server with a client lib |
Date: |
Tue, 26 Oct 2010 22:31:04 +0200 |
message and text priorities in the server were swapped
w.r.t. the same priorities in the client lib
---
src/common/fdsetconv.c | 4 ++--
src/server/configuration.c | 2 +-
src/server/parse.c | 4 ++--
src/server/speaking.c | 23 ++++++++++++-----------
4 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/common/fdsetconv.c b/src/common/fdsetconv.c
index fa6a760..34a03a2 100644
--- a/src/common/fdsetconv.c
+++ b/src/common/fdsetconv.c
@@ -160,8 +160,8 @@ str2intpriority(char* str)
int priority;
if (!strcmp(str, "important")) priority = 1;
- else if (!strcmp(str, "text")) priority = 2;
- else if (!strcmp(str, "message")) priority = 3;
+ else if (!strcmp(str, "message")) priority = 2;
+ else if (!strcmp(str, "text")) priority = 3;
else if (!strcmp(str, "notification")) priority = 4;
else if (!strcmp(str, "progress")) priority = 5;
else priority = -1;
diff --git a/src/server/configuration.c b/src/server/configuration.c
index 5abafcf..c734e01 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -439,7 +439,7 @@ load_config_options(int *num_options)
void
load_default_global_set_options()
{
- GlobalFDSet.priority = 3;
+ GlobalFDSet.priority = 2;
GlobalFDSet.punctuation_mode = SPD_PUNCT_NONE;
GlobalFDSet.spelling_mode = 0;
GlobalFDSet.rate = 0;
diff --git a/src/server/parse.c b/src/server/parse.c
index 3e4d606..9ce3c48 100644
--- a/src/server/parse.c
+++ b/src/server/parse.c
@@ -419,8 +419,8 @@ parse_set(const char *buf, const int bytes, const int fd,
const TSpeechDSock *sp
GET_PARAM_STR(priority_s, 3, CONV_DOWN);
if (TEST_CMD(priority_s, "important")) priority = 1;
- else if (TEST_CMD(priority_s, "text")) priority = 2;
- else if (TEST_CMD(priority_s, "message")) priority = 3;
+ else if (TEST_CMD(priority_s, "message")) priority = 2;
+ else if (TEST_CMD(priority_s, "text")) priority = 3;
else if (TEST_CMD(priority_s, "notification")) priority = 4;
else if (TEST_CMD(priority_s, "progress")) priority = 5;
else{
diff --git a/src/server/speaking.c b/src/server/speaking.c
index f6a0328..6cfcf33 100644
--- a/src/server/speaking.c
+++ b/src/server/speaking.c
@@ -149,19 +149,19 @@ speak(void* data)
/* Handle postponed priority progress message */
check_locked(&element_free_mutex);
if ((g_list_length(last_p5_block) != 0) &&
(g_list_length(MessageQueue->p5) == 0)){
- /* Transfer messages from last_p5_block to priority 3 (message)
queue*/
+ /* Transfer messages from last_p5_block to priority 2 (message)
queue*/
while (g_list_length(last_p5_block) != 0){
GList* item;
item = g_list_first(last_p5_block);
message = item->data;
check_locked(&element_free_mutex);
- MessageQueue->p3 = g_list_insert_sorted(MessageQueue->p3,
message, sortbyuid);
+ MessageQueue->p2 = g_list_insert_sorted(MessageQueue->p2,
message, sortbyuid);
last_p5_block = g_list_remove_link(last_p5_block, item);
g_list_free1(item);
}
assert(message!=NULL);
- highest_priority = 3;
- stop_priority_older_than(2, message->id);
+ highest_priority = 2;
+ stop_priority_older_than(3, message->id);
stop_priority(4);
stop_priority(5);
check_locked(&element_free_mutex);
@@ -896,29 +896,30 @@ void
resolve_priorities(int priority)
{
if(priority == 1){
- if (highest_priority != 1) output_stop();
+ if (SPEAKING && highest_priority != 1)
+ output_stop();
stop_priority(4);
stop_priority(5);
}
if(priority == 2){
- stop_priority_except_first(2);
+ if (SPEAKING && highest_priority != 1 && highest_priority != 2)
+ output_stop();
+ stop_priority(3);
stop_priority(4);
stop_priority(5);
}
if(priority == 3){
- stop_priority(2);
- stop_priority(4);
+ stop_priority_except_first(3);
+ stop_priority(4);
stop_priority(5);
}
if(priority == 4){
stop_priority_except_first(4);
- if (SPEAKING){
- if (highest_priority != 4)
+ if (SPEAKING && highest_priority != 4)
stop_priority(4);
- }
}
if(priority == 5){
--
1.6.0.4