Mercurial > pidgin
annotate src/protocols/msn/utils.c @ 8230:4e354776ae2a
[gaim-migrate @ 8953]
"Well sf seems to be in read only mode.
This patch makes the progress bar in the room list dialog pulse slower.
Previously it pulsed every time a new room was received, and had a pulse
step of 10 until 100 rooms were downloaded, and then switched to a pulse
step of 100.
Now it pulses every time a room is received but no more than once every
100ms. And the pulse step stays constant at 10. This should fix the "my
connection is so far the progress bar is sucking up all my cpu" problem
some lucky individuals have had. Since my connection isn't that fast,
I'm not completely sure how well it works, but it seems good to me.
Simguy tells me it's better.
If you want to test you'll need to download the list on undernet on irc,
or something like that. Other protocols tend to download it too fast to
really see the progress bar.
--Tim Ringenbach"
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Wed, 11 Feb 2004 22:34:55 +0000 |
| parents | 67f9b43c402a |
| children | 06f57183e29f |
| rev | line source |
|---|---|
| 5309 | 1 /** |
|
5312
89948fedf782
[gaim-migrate @ 5684]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
2 * @file utils.c Utility functions |
| 5309 | 3 * |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6359
diff
changeset
|
7 * |
| 5309 | 8 * This program is free software; you can redistribute it and/or modify |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 #include "msn.h" | |
| 23 | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
24 void |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
25 msn_parse_format(const char *mime, char **pre_ret, char **post_ret) |
| 5309 | 26 { |
| 27 char *cur; | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
28 GString *pre = g_string_new(NULL); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
29 GString *post = g_string_new(NULL); |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
30 unsigned int colors[3]; |
| 5309 | 31 |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
32 if (pre_ret != NULL) *pre_ret = NULL; |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
33 if (post_ret != NULL) *post_ret = NULL; |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
34 |
| 5309 | 35 cur = strstr(mime, "FN="); |
| 36 | |
| 37 if (cur && (*(cur = cur + 3) != ';')) { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
38 pre = g_string_append(pre, "<FONT FACE=\""); |
| 5309 | 39 |
| 40 while (*cur && *cur != ';') { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
41 pre = g_string_append_c(pre, *cur); |
| 5309 | 42 cur++; |
| 43 } | |
| 44 | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
45 pre = g_string_append(pre, "\">"); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
46 post = g_string_prepend(post, "</FONT>"); |
| 5309 | 47 } |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
48 |
| 5309 | 49 cur = strstr(mime, "EF="); |
| 50 | |
| 51 if (cur && (*(cur = cur + 3) != ';')) { | |
| 52 while (*cur && *cur != ';') { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
53 pre = g_string_append_c(pre, '<'); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
54 pre = g_string_append_c(pre, *cur); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
55 pre = g_string_append_c(pre, '>'); |
| 5309 | 56 cur++; |
| 57 } | |
| 58 } | |
| 59 | |
| 60 cur = strstr(mime, "CO="); | |
| 61 | |
| 62 if (cur && (*(cur = cur + 3) != ';')) { | |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
63 int i; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
64 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
65 i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
66 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
67 if (i > 0) { |
| 5309 | 68 char tag[64]; |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
69 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
70 if (i == 1) { |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
71 colors[2] = colors[0]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
72 colors[1] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
73 colors[0] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
74 } |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
75 else if (i == 2) { |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
76 colors[2] = colors[1]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
77 colors[1] = colors[0]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
78 colors[0] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
79 } |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
80 |
| 5309 | 81 g_snprintf(tag, sizeof(tag), |
| 82 "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", | |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
83 colors[2], colors[1], colors[0]); |
| 5309 | 84 |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
85 pre = g_string_append(pre, tag); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
86 post = g_string_prepend(post, "</FONT>"); |
| 5309 | 87 } |
| 88 } | |
| 89 | |
| 7134 | 90 cur = g_strdup(gaim_url_decode(pre->str)); |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
91 g_string_free(pre, TRUE); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
92 |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
93 if (pre_ret != NULL) |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
94 *pre_ret = cur; |
|
6359
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
95 else |
|
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
96 g_free(cur); |
| 5309 | 97 |
| 7134 | 98 cur = g_strdup(gaim_url_decode(post->str)); |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
99 g_string_free(post, TRUE); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
100 |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
101 if (post_ret != NULL) |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
102 *post_ret = cur; |
|
6359
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
103 else |
|
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
104 g_free(cur); |
| 5309 | 105 } |
