src/protocols/bonjour/jabber.c

changeset 12443
ad94864144f8
parent 11830
a0cae984e2d9
child 12708
54098581385f
equal deleted inserted replaced
12442:de1895ff7709 12443:ad94864144f8
43 43
44 #include "jabber.h" 44 #include "jabber.h"
45 #include "bonjour.h" 45 #include "bonjour.h"
46 #include "buddy.h" 46 #include "buddy.h"
47 47
48 gint 48 static gint
49 _connect_to_buddy(GaimBuddy *gb) 49 _connect_to_buddy(GaimBuddy *gb)
50 { 50 {
51 gint socket_fd; 51 gint socket_fd;
52 gint retorno = 0; 52 gint retorno = 0;
53 struct sockaddr_in buddy_address; 53 struct sockaddr_in buddy_address;
67 fcntl(socket_fd, F_SETFL, O_NONBLOCK); 67 fcntl(socket_fd, F_SETFL, O_NONBLOCK);
68 68
69 return socket_fd; 69 return socket_fd;
70 } 70 }
71 71
72 const char * 72 #if 0 /* this isn't used anywhere... */
73 static const char *
73 _font_size_gaim_to_ichat(int size) 74 _font_size_gaim_to_ichat(int size)
74 { 75 {
75 switch (size) { 76 switch (size) {
76 case 1: 77 case 1:
77 return "8"; 78 return "8";
89 return "24"; 90 return "24";
90 } 91 }
91 92
92 return "12"; 93 return "12";
93 } 94 }
94 95 #endif
95 const char * 96
97 static const char *
96 _font_size_ichat_to_gaim(int size) 98 _font_size_ichat_to_gaim(int size)
97 { 99 {
98 if (size > 24) { 100 if (size > 24) {
99 return "7"; 101 return "7";
100 } else if (size >= 21) { 102 } else if (size >= 21) {
109 return "2"; 111 return "2";
110 } 112 }
111 113
112 return "1"; 114 return "1";
113 } 115 }
114 void 116 static void
115 _jabber_parse_and_write_message_to_ui(char *message, GaimConnection *connection, GaimBuddy *gb) 117 _jabber_parse_and_write_message_to_ui(char *message, GaimConnection *connection, GaimBuddy *gb)
116 { 118 {
117 xmlnode *body_node = NULL; 119 xmlnode *body_node = NULL;
118 char *body = NULL; 120 char *body = NULL;
119 xmlnode *html_node = NULL; 121 xmlnode *html_node = NULL;
214 xmlnode_free(message_node); 216 xmlnode_free(message_node);
215 g_free(body); 217 g_free(body);
216 g_free(html_body); 218 g_free(html_body);
217 } 219 }
218 220
219 gboolean 221 static gboolean
220 _check_buddy_by_address(gpointer key, gpointer value, gpointer address) 222 _check_buddy_by_address(gpointer key, gpointer value, gpointer address)
221 { 223 {
222 GaimBuddy *gb = (GaimBuddy*)value; 224 GaimBuddy *gb = (GaimBuddy*)value;
223 BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data; 225 BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
224 226
232 } else { 234 } else {
233 return FALSE; 235 return FALSE;
234 } 236 }
235 } 237 }
236 238
237 gint 239 static gint
238 _read_data(gint socket, char **message) 240 _read_data(gint socket, char **message)
239 { 241 {
240 GString *data = g_string_new(""); 242 GString *data = g_string_new("");
241 char parcial_data[512]; 243 char parcial_data[512];
242 gint total_message_length = 0; 244 gint total_message_length = 0;
263 gaim_debug_info("bonjour", "Receive: -%s- %d bytes\n", *message, total_message_length); 265 gaim_debug_info("bonjour", "Receive: -%s- %d bytes\n", *message, total_message_length);
264 266
265 return total_message_length; 267 return total_message_length;
266 } 268 }
267 269
268 gint 270 static gint
269 _send_data(gint socket, char *message) 271 _send_data(gint socket, char *message)
270 { 272 {
271 gint message_len = strlen(message); 273 gint message_len = strlen(message);
272 gint parcial_sent = 0; 274 gint parcial_sent = 0;
273 gchar *parcial_message = message; 275 gchar *parcial_message = message;
283 } 285 }
284 286
285 return strlen(message); 287 return strlen(message);
286 } 288 }
287 289
288 void 290 static void
289 _client_socket_handler(gpointer data, gint socket, GaimInputCondition condition) 291 _client_socket_handler(gpointer data, gint socket, GaimInputCondition condition)
290 { 292 {
291 char *message = NULL; 293 char *message = NULL;
292 gint message_length; 294 gint message_length;
293 GaimBuddy *gb = (GaimBuddy*)data; 295 GaimBuddy *gb = (GaimBuddy*)data;
358 /* Parse the message to get the data and send to the ui */ 360 /* Parse the message to get the data and send to the ui */
359 _jabber_parse_and_write_message_to_ui(message, account->gc, gb); 361 _jabber_parse_and_write_message_to_ui(message, account->gc, gb);
360 } 362 }
361 } 363 }
362 364
363 void 365 static void
364 _server_socket_handler(gpointer data, int server_socket, GaimInputCondition condition) 366 _server_socket_handler(gpointer data, int server_socket, GaimInputCondition condition)
365 { 367 {
366 GaimBuddy *gb = NULL; 368 GaimBuddy *gb = NULL;
367 struct sockaddr_in their_addr; /* connector's address information */ 369 struct sockaddr_in their_addr; /* connector's address information */
368 socklen_t sin_size = sizeof(struct sockaddr); 370 socklen_t sin_size = sizeof(struct sockaddr);

mercurial