Mercurial > pidgin.yaz
comparison src/server.c @ 5136:381da05cb5ed
[gaim-migrate @ 5500]
this started out as simply adding an option to right-click on a jabber buddy
and re-request authorization. Then I ended up chasing the disgusting mess
of const vs non-const parameters all over gaim.
The end result is that you can now right-click on jabber buddies and
re-request auth like you can for ICQ. Also, a lot more things are const
that should be, I fixed a bug or two, and I cleaned up one of my least
favorite functions in gaim (linkify_text). It is now decidedly less evil.
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Tue, 15 Apr 2003 04:18:00 +0000 |
| parents | 2ff05a24192b |
| children | 13ffa9ae4282 |
comparison
equal
deleted
inserted
replaced
| 5135:102135caa225 | 5136:381da05cb5ed |
|---|---|
| 202 { | 202 { |
| 203 if (g && g->prpl && g->prpl->get_info) | 203 if (g && g->prpl && g->prpl->get_info) |
| 204 g->prpl->get_info(g, name); | 204 g->prpl->get_info(g, name); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void serv_get_away(struct gaim_connection *g, char *name) | 207 void serv_get_away(struct gaim_connection *g, const char *name) |
| 208 { | 208 { |
| 209 if (g && g->prpl && g->prpl->get_away) | 209 if (g && g->prpl && g->prpl->get_away) |
| 210 g->prpl->get_away(g, name); | 210 g->prpl->get_away(g, name); |
| 211 } | 211 } |
| 212 | 212 |
| 555 | 555 |
| 556 /* | 556 /* |
| 557 * woo. i'm actually going to comment this function. isn't that fun. make | 557 * woo. i'm actually going to comment this function. isn't that fun. make |
| 558 * sure to follow along, kids | 558 * sure to follow along, kids |
| 559 */ | 559 */ |
| 560 void serv_got_im(struct gaim_connection *gc, char *name, char *message, | 560 void serv_got_im(struct gaim_connection *gc, const char *who, const char *msg, |
| 561 guint32 flags, time_t mtime, gint len) | 561 guint32 flags, time_t mtime, gint len) |
| 562 { | 562 { |
| 563 char *buffy; | 563 char *buffy; |
| 564 char *angel; | 564 char *angel; |
| 565 int plugin_return; | 565 int plugin_return; |
| 566 int away = 0; | 566 int away = 0; |
| 567 | 567 |
| 568 struct gaim_conversation *cnv; | 568 struct gaim_conversation *cnv; |
| 569 | |
| 570 char *message, *name; | |
| 569 | 571 |
| 570 /* | 572 /* |
| 571 * Pay no attention to the man behind the curtain. | 573 * Pay no attention to the man behind the curtain. |
| 572 * | 574 * |
| 573 * The reason i feel okay with this is because it's useful to some | 575 * The reason i feel okay with this is because it's useful to some |
| 577 * a plugin author, don't rely on this, still do your own checks. But uh. | 579 * a plugin author, don't rely on this, still do your own checks. But uh. |
| 578 * It's a start. | 580 * It's a start. |
| 579 */ | 581 */ |
| 580 | 582 |
| 581 if (flags & IM_FLAG_GAIMUSER) | 583 if (flags & IM_FLAG_GAIMUSER) |
| 582 debug_printf("%s is a gaim user.\n", name); | 584 debug_printf("%s is a gaim user.\n", who); |
| 583 | 585 |
| 584 /* | 586 /* |
| 585 * We should update the conversation window buttons and menu, | 587 * We should update the conversation window buttons and menu, |
| 586 * if it exists. | 588 * if it exists. |
| 587 */ | 589 */ |
| 588 cnv = gaim_find_conversation_with_account(name, gc->account); | 590 cnv = gaim_find_conversation_with_account(who, gc->account); |
| 589 | 591 |
| 590 /* | 592 /* |
| 591 * Plugin stuff. we pass a char ** but we don't want to pass what's | 593 * Plugin stuff. we pass a char ** but we don't want to pass what's |
| 592 * been given us by the prpls. So we create temp holders and pass | 594 * been given us by the prpls. So we create temp holders and pass |
| 593 * those instead. It's basically just to avoid segfaults. Of course, | 595 * those instead. It's basically just to avoid segfaults. Of course, |
| 594 * if the data is binary, plugins don't see it. Bitch all you want; | 596 * if the data is binary, plugins don't see it. Bitch all you want; |
| 595 * I really don't want you to be dealing with it. | 597 * I really don't want you to be dealing with it. |
| 596 */ | 598 */ |
| 597 if (len < 0) { | 599 if (len < 0) { |
| 598 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); | 600 buffy = g_malloc(MAX(strlen(msg) + 1, BUF_LONG)); |
| 599 strcpy(buffy, message); | 601 strcpy(buffy, msg); |
| 600 angel = g_strdup(name); | 602 angel = g_strdup(who); |
| 601 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, &flags); | 603 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, &flags); |
| 602 | 604 |
| 603 if (!buffy || !angel || plugin_return) { | 605 if (!buffy || !angel || plugin_return) { |
| 604 if (buffy) | 606 if (buffy) |
| 605 g_free(buffy); | 607 g_free(buffy); |
| 608 return; | 610 return; |
| 609 } | 611 } |
| 610 name = angel; | 612 name = angel; |
| 611 message = buffy; | 613 message = buffy; |
| 612 } else { | 614 } else { |
| 613 name = g_strdup(name); | 615 name = g_strdup(who); |
| 614 message = g_memdup(message, len); | 616 message = g_memdup(msg, len); |
| 615 } | 617 } |
| 616 | 618 |
| 617 #if 0 | 619 #if 0 |
| 618 /* | 620 /* |
| 619 * TiK, using TOC, sends an automated message in order to get your | 621 * TiK, using TOC, sends an automated message in order to get your |
| 636 | 638 |
| 637 /* | 639 /* |
| 638 * If you can't figure this out, stop reading right now. | 640 * If you can't figure this out, stop reading right now. |
| 639 * "We're not worthy! We're not worthy!" | 641 * "We're not worthy! We're not worthy!" |
| 640 */ | 642 */ |
| 641 if ((len < 0) && (convo_options & OPT_CONVO_SEND_LINKS)) | 643 if ((len < 0) && (convo_options & OPT_CONVO_SEND_LINKS)) { |
| 642 linkify_text(message); | 644 buffy = linkify_text(message); |
| 645 g_free(message); | |
| 646 message = buffy; | |
| 647 } | |
| 643 | 648 |
| 644 /* | 649 /* |
| 645 * Um. When we call gaim_conversation_write with the message we received, | 650 * Um. When we call gaim_conversation_write with the message we received, |
| 646 * it's nice to pass whether or not it was an auto-response. So if it | 651 * it's nice to pass whether or not it was an auto-response. So if it |
| 647 * was an auto-response, we set the appropriate flag. This is just so | 652 * was an auto-response, we set the appropriate flag. This is just so |
| 685 struct queued_message *qm; | 690 struct queued_message *qm; |
| 686 GtkTreeIter iter; | 691 GtkTreeIter iter; |
| 687 gchar path[10]; | 692 gchar path[10]; |
| 688 | 693 |
| 689 qm = g_new0(struct queued_message, 1); | 694 qm = g_new0(struct queued_message, 1); |
| 690 g_snprintf(qm->name, sizeof(qm->name), "%s", name); | 695 g_snprintf(qm->name, sizeof(qm->name), "%s", name); |
| 691 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len); | 696 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len); |
| 692 qm->account = gc->account; | 697 qm->account = gc->account; |
| 693 qm->tm = mtime; | 698 qm->tm = mtime; |
| 694 qm->flags = WFLAG_RECV | away; | 699 qm->flags = WFLAG_RECV | away; |
| 695 qm->len = len; | 700 qm->len = len; |
| 1186 return; | 1191 return; |
| 1187 } | 1192 } |
| 1188 who = angel; | 1193 who = angel; |
| 1189 message = buffy; | 1194 message = buffy; |
| 1190 | 1195 |
| 1196 | |
| 1197 | |
| 1191 buf = g_malloc(MAX(strlen(message) * 2, 8192)); | 1198 buf = g_malloc(MAX(strlen(message) * 2, 8192)); |
| 1192 strcpy(buf, message); | 1199 strcpy(buf, message); |
| 1193 | 1200 |
| 1194 if (convo_options & OPT_CONVO_SEND_LINKS) | 1201 if (convo_options & OPT_CONVO_SEND_LINKS) |
| 1195 linkify_text(buf); | 1202 buf = linkify_text(message); |
| 1203 else | |
| 1204 buf = g_strdup(message); | |
| 1196 | 1205 |
| 1197 if (whisper) | 1206 if (whisper) |
| 1198 w = WFLAG_WHISPER; | 1207 w = WFLAG_WHISPER; |
| 1199 else | 1208 else |
| 1200 w = 0; | 1209 w = 0; |
