Mercurial > pidgin.yaz
comparison src/conversation.c @ 1002:1d8f05ea6bdf
[gaim-migrate @ 1012]
i don't even remember what happened. all good things, i hope
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 18 Oct 2000 02:38:18 +0000 |
parents | 91b7377e7b45 |
children | 38452403563b |
comparison
equal
deleted
inserted
replaced
1001:b8a819390499 | 1002:1d8f05ea6bdf |
---|---|
162 } | 162 } |
163 g_free(cuser); | 163 g_free(cuser); |
164 return NULL; | 164 return NULL; |
165 } | 165 } |
166 | 166 |
167 void make_direct(struct conversation *c, gboolean direct, struct aim_conn_t *conn, gint watcher) | |
168 { | |
169 char buf[BUF_LONG]; | |
170 if (c == NULL) return; | |
171 c->is_direct = direct; | |
172 if (direct) { | |
173 c->conn = conn; | |
174 c->watcher = watcher; | |
175 g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s established.</B><BR><HR>"), | |
176 c->name); | |
177 write_to_conv(c, buf, WFLAG_SYSTEM, NULL); | |
178 } else { | |
179 c->conn = NULL; | |
180 gdk_input_remove(c->watcher); | |
181 c->watcher = -1; | |
182 g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s closed.</B><BR><HR>"), | |
183 c->name); | |
184 write_to_conv(c, buf, WFLAG_SYSTEM, NULL); | |
185 } | |
186 } | |
187 | |
188 /* --------------------------------------------------- | 167 /* --------------------------------------------------- |
189 * Function to remove a log file entry | 168 * Function to remove a log file entry |
190 * --------------------------------------------------- | 169 * --------------------------------------------------- |
191 */ | 170 */ |
192 | 171 |
388 c->log_dialog = NULL; | 367 c->log_dialog = NULL; |
389 | 368 |
390 if (c->is_chat) { | 369 if (c->is_chat) { |
391 serv_chat_leave(c->gc, c->id); | 370 serv_chat_leave(c->gc, c->id); |
392 } else { | 371 } else { |
393 if (c->is_direct) { | |
394 /* FIXME | |
395 if (c->gc->protocol == PROTO_OSCAR) { | |
396 gdk_input_remove(c->watcher); | |
397 sprintf(debug_buff, "Closing DirectIM conversation (%p)\n", c->conn); | |
398 debug_print(debug_buff); | |
399 aim_conn_kill(((struct oscar_data *)c->gc->proto_data)->sess, | |
400 &c->conn); | |
401 } else { | |
402 Direct IM TOC FIXME | |
403 } | |
404 */ | |
405 } | |
406 delete_conversation(c); | 372 delete_conversation(c); |
407 } | 373 } |
408 | 374 |
409 return TRUE; | 375 return TRUE; |
410 } | 376 } |
613 { | 579 { |
614 char *buf, *buf2, *buf3; | 580 char *buf, *buf2, *buf3; |
615 int hdrlen, limit; | 581 int hdrlen, limit; |
616 | 582 |
617 if (!c->gc) return; | 583 if (!c->gc) return; |
618 if (c->is_direct) limit = 0x8000; /* 32 k */ | 584 /* FIXME! this used to have limits based on protocol limits (oscar chat was 512, |
619 else if (c->is_chat && c->gc->protocol == PROTO_OSCAR) limit = MAXCHATMSGLEN; | 585 * oscar im was 7985, toc was 4k). we shouldn't be using PROTO_whatever here. it |
620 else if (c->gc->protocol == PROTO_OSCAR) limit = MAXMSGLEN; | 586 * should be gotten from the PRPL somehow */ |
621 else limit = MSG_LEN; | 587 limit = 7985 << 2; |
622 limit <<= 2; | |
623 | 588 |
624 buf = g_malloc(limit); | 589 buf = g_malloc(limit); |
625 | 590 |
626 buf2 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); | 591 buf2 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); |
627 g_snprintf(buf, limit, "%s", buf2); | 592 g_snprintf(buf, limit, "%s", buf2); |
639 | 604 |
640 /* Let us determine how long the message CAN be. | 605 /* Let us determine how long the message CAN be. |
641 * toc_send_im is 11 chars long + 2 quotes. | 606 * toc_send_im is 11 chars long + 2 quotes. |
642 * + 2 spaces + 6 for the header + 2 for good | 607 * + 2 spaces + 6 for the header + 2 for good |
643 * measure = 23 bytes + the length of normalize c->name */ | 608 * measure = 23 bytes + the length of normalize c->name */ |
644 if (c->gc->protocol == PROTO_TOC) | 609 /* FIXME: the hdrlen is for how long the header is going to cut off the limit. |
645 hdrlen = 23 + strlen(normalize(c->name)); | 610 * but since we don't know on a protocol basis anymore we can't do this. so we'll |
646 else | 611 * just assume it's 23 + strlen(normalize(c->name)) for all protocols */ |
647 hdrlen = 0; | 612 hdrlen = 23 + strlen(normalize(c->name)); |
648 | 613 |
649 if (font_options & OPT_FONT_BOLD) { | 614 if (font_options & OPT_FONT_BOLD) { |
650 g_snprintf(buf2, limit, "<B>%s</B>", buf); | 615 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
651 strcpy(buf, buf2); | 616 strcpy(buf, buf2); |
652 } | 617 } |