Changeset 6738a67 for protocols/oscar
- Timestamp:
- 2008-07-16T23:22:52Z (16 years ago)
- Branches:
- master
- Children:
- 9b55485
- Parents:
- 9730d72 (diff), 6a78c0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
r9730d72 r6738a67 60 60 61 61 #define OSCAR_GROUP "Friends" 62 63 #define BUF_LEN 2048 64 #define BUF_LONG ( BUF_LEN * 2 ) 62 65 63 66 /* Don't know if support for UTF8 is really working. For now it's UTF16 here. … … 240 243 }; 241 244 static int msgerrreasonlen = 25; 245 246 /* Hurray, this function is NOT thread-safe \o/ */ 247 static char *normalize(const char *s) 248 { 249 static char buf[BUF_LEN]; 250 char *t, *u; 251 int x = 0; 252 253 g_return_val_if_fail((s != NULL), NULL); 254 255 u = t = g_strdup(s); 256 257 strcpy(t, s); 258 g_strdown(t); 259 260 while (*t && (x < BUF_LEN - 1)) { 261 if (*t != ' ' && *t != '!') { 262 buf[x] = *t; 263 x++; 264 } 265 t++; 266 } 267 buf[x] = '\0'; 268 g_free(u); 269 return buf; 270 } 242 271 243 272 static gboolean oscar_callback(gpointer data, gint source, … … 1002 1031 } 1003 1032 1004 tmp = g_strdup(normalize(ic->acc->user)); 1005 if (!strcmp(tmp, normalize(info->sn))) 1033 if (!aim_sncmp(ic->acc->user, info->sn)) 1006 1034 g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); 1007 g_free(tmp); 1008 1009 imcb_buddy_status(ic, info->sn, flags, state_string, NULL); 1010 /* imcb_buddy_times(ic, info->sn, signon, time_idle); */ 1035 1036 tmp = normalize(info->sn); 1037 imcb_buddy_status(ic, tmp, flags, state_string, NULL); 1038 /* imcb_buddy_times(ic, tmp, signon, time_idle); */ 1039 1011 1040 1012 1041 return 1; … … 1022 1051 va_end(ap); 1023 1052 1024 imcb_buddy_status(ic, info->sn, 0, NULL, NULL );1053 imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL ); 1025 1054 1026 1055 return 1; … … 1078 1107 1079 1108 strip_linefeed(tmp); 1080 imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0);1109 imcb_buddy_msg(ic, normalize(userinfo->sn), tmp, flags, 0); 1081 1110 g_free(tmp); 1082 1111 … … 1084 1113 } 1085 1114 1086 void oscar_accept_chat( gpointer w, struct aim_chat_invitation * inv);1087 void oscar_reject_chat( gpointer w, struct aim_chat_invitation * inv);1115 void oscar_accept_chat(void *data); 1116 void oscar_reject_chat(void *data); 1088 1117 1089 1118 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { … … 1119 1148 } 1120 1149 1121 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { 1150 static void gaim_icq_authgrant(void *data_) { 1151 struct icq_auth *data = data_; 1122 1152 char *uin, message; 1123 1153 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 1134 1164 } 1135 1165 1136 static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { 1166 static void gaim_icq_authdeny(void *data_) { 1167 struct icq_auth *data = data_; 1137 1168 char *uin, *message; 1138 1169 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 1175 1206 message = g_strdup(args->msg); 1176 1207 strip_linefeed(message); 1177 imcb_buddy_msg(ic, uin, message, 0, 0);1208 imcb_buddy_msg(ic, normalize(uin), message, 0, 0); 1178 1209 g_free(uin); 1179 1210 g_free(message); … … 1194 1225 1195 1226 strip_linefeed(message); 1196 imcb_buddy_msg(ic, uin, message, 0, 0);1227 imcb_buddy_msg(ic, normalize(uin), message, 0, 0); 1197 1228 g_free(uin); 1198 1229 g_free(m); … … 1469 1500 1470 1501 for (i = 0; i < count; i++) 1471 imcb_chat_add_buddy(c->cnv, info[i].sn);1502 imcb_chat_add_buddy(c->cnv, normalize(info[i].sn)); 1472 1503 1473 1504 return 1; … … 1492 1523 1493 1524 for (i = 0; i < count; i++) 1494 imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL);1525 imcb_chat_remove_buddy(c->cnv, normalize(info[i].sn), NULL); 1495 1526 1496 1527 return 1; … … 1543 1574 tmp = g_malloc(BUF_LONG); 1544 1575 g_snprintf(tmp, BUF_LONG, "%s", msg); 1545 imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);1576 imcb_chat_msg(ccon->cnv, normalize(info->sn), tmp, 0, 0); 1546 1577 g_free(tmp); 1547 1578 … … 1756 1787 g_snprintf(sender, sizeof(sender), "%u", msg->sender); 1757 1788 strip_linefeed(dialog_msg); 1758 imcb_buddy_msg(ic, sender, dialog_msg, 0, t);1789 imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); 1759 1790 g_free(dialog_msg); 1760 1791 } break; … … 1777 1808 1778 1809 strip_linefeed(dialog_msg); 1779 imcb_buddy_msg(ic, sender, dialog_msg, 0, t);1810 imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); 1780 1811 g_free(dialog_msg); 1781 1812 g_free(m); … … 2015 2046 struct aim_ssi_item *curitem; 2016 2047 int tmp; 2048 char *nrm; 2017 2049 2018 2050 /* Add from server list to local list */ 2019 2051 tmp = 0; 2020 2052 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { 2053 nrm = curitem->name ? normalize(curitem->name) : NULL; 2054 2021 2055 switch (curitem->type) { 2022 2056 case 0x0000: /* Buddy */ 2023 if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) {2057 if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) { 2024 2058 char *realname = NULL; 2025 2059 … … 2027 2061 realname = aim_gettlv_str(curitem->data, 0x0131, 1); 2028 2062 2029 imcb_add_buddy(ic, curitem->name, NULL);2063 imcb_add_buddy(ic, nrm, NULL); 2030 2064 2031 2065 if (realname) { 2032 imcb_buddy_nick_hint(ic, curitem->name, realname);2033 imcb_rename_buddy(ic, curitem->name, realname);2066 imcb_buddy_nick_hint(ic, nrm, realname); 2067 imcb_rename_buddy(ic, nrm, realname); 2034 2068 g_free(realname); 2035 2069 } … … 2043 2077 if (!list) { 2044 2078 char *name; 2045 name = g_strdup(n ormalize(curitem->name));2079 name = g_strdup(nrm); 2046 2080 ic->permit = g_slist_append(ic->permit, name); 2047 2081 tmp++; … … 2056 2090 if (!list) { 2057 2091 char *name; 2058 name = g_strdup(n ormalize(curitem->name));2092 name = g_strdup(nrm); 2059 2093 ic->deny = g_slist_append(ic->deny, name); 2060 2094 tmp++; … … 2118 2152 if( st == 0x00 ) 2119 2153 { 2120 imcb_add_buddy( sess->aux_data, list, NULL );2154 imcb_add_buddy( sess->aux_data, normalize(list), NULL ); 2121 2155 } 2122 2156 else if( st == 0x0E ) … … 2448 2482 if(type2 == 0x0002) { 2449 2483 /* User is typing */ 2450 imcb_buddy_typing(ic, sn, OPT_TYPING);2484 imcb_buddy_typing(ic, normalize(sn), OPT_TYPING); 2451 2485 } 2452 2486 else if (type2 == 0x0001) { 2453 2487 /* User has typed something, but is not actively typing (stale) */ 2454 imcb_buddy_typing(ic, sn, OPT_THINKING);2488 imcb_buddy_typing(ic, normalize(sn), OPT_THINKING); 2455 2489 } 2456 2490 else { 2457 2491 /* User has stopped typing */ 2458 imcb_buddy_typing(ic, sn, 0);2492 imcb_buddy_typing(ic, normalize(sn), 0); 2459 2493 } 2460 2494 … … 2588 2622 } 2589 2623 2590 void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) 2591 { 2624 void oscar_accept_chat(void *data) 2625 { 2626 struct aim_chat_invitation * inv = data; 2627 2592 2628 oscar_chat_join(inv->ic, inv->name, NULL, NULL); 2593 2629 g_free(inv->name); … … 2595 2631 } 2596 2632 2597 void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv) 2598 { 2633 void oscar_reject_chat(void *data) 2634 { 2635 struct aim_chat_invitation * inv = data; 2636 2599 2637 g_free(inv->name); 2600 2638 g_free(inv);
Note: See TracChangeset
for help on using the changeset viewer.