- Timestamp:
- 2006-05-26T09:03:38Z (18 years ago)
- Branches:
- master
- Children:
- cdca30b
- Parents:
- 41ca004 (diff), c53911e (diff), 7bfd574 (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. - Location:
- protocols
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/http_client.c
r41ca004 r68b518d6 240 240 241 241 got_reply: 242 /* Maybe if the webserver is overloaded, or when there's bad SSL 243 support... */ 244 if( req->bytes_read == 0 ) 245 goto cleanup; 246 242 247 /* Zero termination is very convenient. */ 243 248 req->reply_headers[req->bytes_read] = 0; -
protocols/nogaim.c
r41ca004 r68b518d6 36 36 #include <ctype.h> 37 37 38 static char *proto_away_alias[8][5] =39 {40 { "Away from computer", "Away", "Extended away", NULL },41 { "NA", "N/A", "Not available", NULL },42 { "Busy", "Do not disturb", "DND", "Occupied", NULL },43 { "Be right back", "BRB", NULL },44 { "On the phone", "Phone", "On phone", NULL },45 { "Out to lunch", "Lunch", "Food", NULL },46 { "Invisible", "Hidden" },47 { NULL }48 };49 static char *proto_away_alias_find( GList *gcm, char *away );50 51 38 static int remove_chat_buddy_silent( struct conversation *b, char *handle ); 52 39 … … 156 143 GSList *get_connections() { return connections; } 157 144 158 int proto_away( struct gaim_connection *gc, char *away )159 {160 GList *m, *ms;161 char *s;162 163 if( !away ) away = "";164 ms = m = gc->prpl->away_states( gc );165 166 while( m )167 {168 if( *away )169 {170 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 )171 break;172 }173 else174 {175 if( g_strcasecmp( m->data, "Available" ) == 0 )176 break;177 if( g_strcasecmp( m->data, "Online" ) == 0 )178 break;179 }180 m = m->next;181 }182 183 if( m )184 {185 gc->prpl->set_away( gc, m->data, *away ? away : NULL );186 }187 else188 {189 s = proto_away_alias_find( ms, away );190 if( s )191 {192 gc->prpl->set_away( gc, s, away );193 if( set_getint( gc->irc, "debug" ) )194 serv_got_crap( gc, "Setting away state to %s", s );195 }196 else197 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );198 }199 200 g_list_free( ms );201 202 return( 1 );203 }204 205 static char *proto_away_alias_find( GList *gcm, char *away )206 {207 GList *m;208 int i, j;209 210 for( i = 0; *proto_away_alias[i]; i ++ )211 {212 for( j = 0; proto_away_alias[i][j]; j ++ )213 if( g_strncasecmp( away, proto_away_alias[i][j], strlen( proto_away_alias[i][j] ) ) == 0 )214 break;215 216 if( !proto_away_alias[i][j] ) /* If we reach the end, this row */217 continue; /* is not what we want. Next! */218 219 /* Now find an entry in this row which exists in gcm */220 for( j = 0; proto_away_alias[i][j]; j ++ )221 {222 m = gcm;223 while( m )224 {225 if( g_strcasecmp( proto_away_alias[i][j], m->data ) == 0 )226 return( proto_away_alias[i][j] );227 m = m->next;228 }229 }230 }231 232 return( NULL );233 }234 235 145 /* multi.c */ 236 146 … … 357 267 /* Also necessary when we're not away, at least for some of the 358 268 protocols. */ 359 proto_away( gc, u->away );269 bim_set_away( gc, u->away ); 360 270 } 361 271 … … 481 391 else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] ) 482 392 { 483 u->host = g_strdup( gc->user->proto_opt[0] ); 393 char *colon; 394 395 if( ( colon = strchr( gc->user->proto_opt[0], ':' ) ) ) 396 u->host = g_strndup( gc->user->proto_opt[0], 397 colon - gc->user->proto_opt[0] ); 398 else 399 u->host = g_strdup( gc->user->proto_opt[0] ); 400 484 401 u->user = g_strdup( handle ); 485 402 … … 1022 939 } 1023 940 1024 int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags ) 941 942 943 944 /* The plan is to not allow straight calls to prpl functions anymore, but do 945 them all from some wrappers. We'll start to define some down here: */ 946 947 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ) 1025 948 { 1026 949 char *buf = NULL; 1027 950 int st; 1028 951 1029 if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )952 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 1030 953 { 1031 954 buf = escape_html( msg ); … … 1033 956 } 1034 957 1035 st = ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags );958 st = gc->prpl->send_im( gc, handle, msg, strlen( msg ), flags ); 1036 959 g_free( buf ); 1037 960 … … 1039 962 } 1040 963 1041 int serv_send_chat( irc_t *irc,struct gaim_connection *gc, int id, char *msg )964 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ) 1042 965 { 1043 966 char *buf = NULL; … … 1055 978 return st; 1056 979 } 980 981 static char *bim_away_alias_find( GList *gcm, char *away ); 982 983 int bim_set_away( struct gaim_connection *gc, char *away ) 984 { 985 GList *m, *ms; 986 char *s; 987 988 if( !away ) away = ""; 989 ms = m = gc->prpl->away_states( gc ); 990 991 while( m ) 992 { 993 if( *away ) 994 { 995 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) 996 break; 997 } 998 else 999 { 1000 if( g_strcasecmp( m->data, "Available" ) == 0 ) 1001 break; 1002 if( g_strcasecmp( m->data, "Online" ) == 0 ) 1003 break; 1004 } 1005 m = m->next; 1006 } 1007 1008 if( m ) 1009 { 1010 gc->prpl->set_away( gc, m->data, *away ? away : NULL ); 1011 } 1012 else 1013 { 1014 s = bim_away_alias_find( ms, away ); 1015 if( s ) 1016 { 1017 gc->prpl->set_away( gc, s, away ); 1018 if( set_getint( gc->irc, "debug" ) ) 1019 serv_got_crap( gc, "Setting away state to %s", s ); 1020 } 1021 else 1022 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); 1023 } 1024 1025 g_list_free( ms ); 1026 1027 return( 1 ); 1028 } 1029 1030 static char *bim_away_alias_list[8][5] = 1031 { 1032 { "Away from computer", "Away", "Extended away", NULL }, 1033 { "NA", "N/A", "Not available", NULL }, 1034 { "Busy", "Do not disturb", "DND", "Occupied", NULL }, 1035 { "Be right back", "BRB", NULL }, 1036 { "On the phone", "Phone", "On phone", NULL }, 1037 { "Out to lunch", "Lunch", "Food", NULL }, 1038 { "Invisible", "Hidden" }, 1039 { NULL } 1040 }; 1041 1042 static char *bim_away_alias_find( GList *gcm, char *away ) 1043 { 1044 GList *m; 1045 int i, j; 1046 1047 for( i = 0; *bim_away_alias_list[i]; i ++ ) 1048 { 1049 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1050 if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 ) 1051 break; 1052 1053 if( !bim_away_alias_list[i][j] ) /* If we reach the end, this row */ 1054 continue; /* is not what we want. Next! */ 1055 1056 /* Now find an entry in this row which exists in gcm */ 1057 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1058 { 1059 m = gcm; 1060 while( m ) 1061 { 1062 if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 ) 1063 return( bim_away_alias_list[i][j] ); 1064 m = m->next; 1065 } 1066 } 1067 } 1068 1069 return( NULL ); 1070 } 1071 1072 void bim_add_allow( struct gaim_connection *gc, char *handle ) 1073 { 1074 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1075 { 1076 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); 1077 } 1078 1079 gc->prpl->add_permit( gc, handle ); 1080 } 1081 1082 void bim_rem_allow( struct gaim_connection *gc, char *handle ) 1083 { 1084 GSList *l; 1085 1086 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1087 { 1088 g_free( l->data ); 1089 gc->permit = g_slist_delete_link( gc->permit, l ); 1090 } 1091 1092 gc->prpl->rem_permit( gc, handle ); 1093 } 1094 1095 void bim_add_block( struct gaim_connection *gc, char *handle ) 1096 { 1097 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1098 { 1099 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); 1100 } 1101 1102 gc->prpl->add_deny( gc, handle ); 1103 } 1104 1105 void bim_rem_block( struct gaim_connection *gc, char *handle ) 1106 { 1107 GSList *l; 1108 1109 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1110 { 1111 g_free( l->data ); 1112 gc->deny = g_slist_delete_link( gc->deny, l ); 1113 } 1114 1115 gc->prpl->rem_deny( gc, handle ); 1116 } -
protocols/nogaim.h
r41ca004 r68b518d6 52 52 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ 53 53 54 #define WEBSITE "http://www.bitl ee.org/"54 #define WEBSITE "http://www.bitlbee.org/" 55 55 #define IM_FLAG_AWAY 0x0020 56 56 #define OPT_CONN_HTML 0x00000001 … … 194 194 195 195 /* nogaim.c */ 196 int serv_send_im(irc_t *irc, user_t *u, char *msg, int flags); 197 int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg ); 196 int bim_set_away( struct gaim_connection *gc, char *away ); 197 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ); 198 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ); 199 200 void bim_add_allow( struct gaim_connection *gc, char *handle ); 201 void bim_rem_allow( struct gaim_connection *gc, char *handle ); 202 void bim_add_block( struct gaim_connection *gc, char *handle ); 203 void bim_rem_block( struct gaim_connection *gc, char *handle ); 198 204 199 205 void nogaim_init(); 200 int proto_away( struct gaim_connection *gc, char *away );201 206 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); 202 207 … … 210 215 G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg ); 211 216 G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg ); 212 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) ;217 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 213 218 G_MODULE_EXPORT void account_online( struct gaim_connection *gc ); 214 219 G_MODULE_EXPORT void signoff( struct gaim_connection *gc ); -
protocols/oscar/aim.h
r41ca004 r68b518d6 728 728 }; 729 729 730 #define AIM_CHATFLAGS_NOREFLECT 0x0001 731 #define AIM_CHATFLAGS_AWAY 0x0002 730 #define AIM_CHATFLAGS_NOREFLECT 0x0001 731 #define AIM_CHATFLAGS_AWAY 0x0002 732 #define AIM_CHATFLAGS_UNICODE 0x0004 733 #define AIM_CHATFLAGS_ISO_8859_1 0x0008 734 732 735 int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen); 733 736 int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); -
protocols/oscar/chat.c
r41ca004 r68b518d6 159 159 if (flags & AIM_CHATFLAGS_AWAY) 160 160 aim_addtlvtochain_noval(&otl, 0x0007); 161 161 162 /* [WvG] This wasn't there originally, but we really should send 163 the right charset flags, as we also do with normal 164 messages. Hope this will work. :-) */ 165 /* 166 if (flags & AIM_CHATFLAGS_UNICODE) 167 aimbs_put16(&fr->data, 0x0002); 168 else if (flags & AIM_CHATFLAGS_ISO_8859_1) 169 aimbs_put16(&fr->data, 0x0003); 170 else 171 aimbs_put16(&fr->data, 0x0000); 172 173 aimbs_put16(&fr->data, 0x0000); 174 */ 175 162 176 /* 163 177 * SubTLV: Type 1: Message -
protocols/oscar/im.c
r41ca004 r68b518d6 1469 1469 case 0x9c: /* ICQ 5 seems to send this */ 1470 1470 aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie, 1471 gc->away , sess->aim_icq_state, dc);1471 gc->away ? gc->away : "", sess->aim_icq_state, dc); 1472 1472 break; 1473 1473 -
protocols/oscar/oscar.c
r41ca004 r68b518d6 2 2 * gaim 3 3 * 4 * Some code copyright (C) 2002-2006, Jelmer Vernooij <jelmer@samba.org> 5 * and the BitlBee team. 4 6 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 5 7 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> … … 136 138 int i, j; 137 139 char *x = strchr(name, '-'); 138 if (!x) return NULL;140 if (!x) return g_strdup(name); 139 141 x = strchr(++x, '-'); 140 if (!x) return NULL;142 if (!x) return g_strdup(name); 141 143 tmp = g_strdup(++x); 142 144 … … 390 392 if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && 391 393 g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { 392 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails." );394 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]); 393 395 } 394 396 … … 2517 2519 int ret; 2518 2520 guint8 len = strlen(message); 2521 guint16 flags; 2519 2522 char *s; 2520 2523 … … 2525 2528 if (*s & 128) 2526 2529 break; 2527 2530 2531 flags = AIM_CHATFLAGS_NOREFLECT; 2532 2528 2533 /* Message contains high ASCII chars, time for some translation! */ 2529 2534 if (*s) { … … 2532 2537 If we can't, fall back to UTF16. */ 2533 2538 if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { 2539 flags |= AIM_CHATFLAGS_ISO_8859_1; 2534 2540 len = ret; 2535 2541 } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { 2542 flags |= AIM_CHATFLAGS_UNICODE; 2536 2543 len = ret; 2537 2544 } else { … … 2544 2551 } 2545 2552 2546 ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len);2553 ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len); 2547 2554 2548 2555 if (s != message) { … … 2617 2624 int ret; 2618 2625 static int chat_id = 0; 2619 char * chatname = g_new0(char, strlen(gc->username)+4);2620 2621 g_snprintf(chatname, strlen(gc->username) + 4,"%s%d", gc->username, chat_id++);2626 char * chatname; 2627 2628 chatname = g_strdup_printf("%s%d", gc->username, chat_id++); 2622 2629 2623 2630 ret = oscar_chat_join(gc, chatname);
Note: See TracChangeset
for help on using the changeset viewer.