Mercurial > pidgin
view src/protocols/msn/slpmsg.c @ 11015:45ceaa1ccc6e
[gaim-migrate @ 12884]
(10:37:16) rizzo: wtf that silc ft patch still not in
(10:38:45) LSchiere2: rizzo: what are you talking about
(10:39:03) rizzo: gaim silc won't build against silc 1.0
(10:39:16) rizzo: has been an issue since gaim 1.3.0
(10:39:29) LSchiere2: I don't recall the patch
(10:39:32) rizzo:
http://www.gentoo.org/cgi-bin/viewcvs.cgi/*checkout*/net-im/gaim/files/gaim-1.3.0-silc-ft.patch
(10:39:41) rizzo: I thought I got it from you guys
(10:39:46) LSchiere2: is it in our tracker?
(10:39:51) rizzo: I don't see it
(10:40:05) ***rizzo digs up his bug
(10:40:57) rizzo: LSchiere2: I think pekka emailed it to -packagers list
(10:41:01) rizzo: http://bugs.gentoo.org/show_bug.cgi?id=92251
(10:41:33) rizzo: from his email:
(10:41:33) rizzo: Enclosed a small patch that makes the Gaim compile with
SILC Toolkit 1.0.
(10:41:33) rizzo: We had unfortunate timing when I released 1.0 at the
same time you
(10:41:33) rizzo: released Gaim 1.3 so I didn't have time to make the
patch for 1.3.
(10:41:33) rizzo: Anyway, the patch removes code that really isn't
supposed to even be
(10:41:33) rizzo: there...
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Fri, 17 Jun 2005 14:53:38 +0000 |
| parents | 0f7452b1f777 |
| children | 93663df88ec4 |
line wrap: on
line source
/** * @file slpmsg.h SLP Message functions * * gaim * * Gaim is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "msn.h" #include "slpmsg.h" #include "slplink.h" /************************************************************************** * SLP Message **************************************************************************/ MsnSlpMessage * msn_slpmsg_new(MsnSlpLink *slplink) { MsnSlpMessage *slpmsg; slpmsg = g_new0(MsnSlpMessage, 1); #ifdef MSN_DEBUG_SLPMSG gaim_debug_info("msn", "slpmsg new (%p)\n", slpmsg); #endif slpmsg->slplink = slplink; slplink->slp_msgs = g_list_append(slplink->slp_msgs, slpmsg); return slpmsg; } void msn_slpmsg_destroy(MsnSlpMessage *slpmsg) { MsnSlpLink *slplink; GList *cur; g_return_if_fail(slpmsg != NULL); #ifdef MSN_DEBUG_SLPMSG gaim_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); #endif slplink = slpmsg->slplink; if (slpmsg->fp != NULL) fclose(slpmsg->fp); if (slpmsg->buffer != NULL) g_free(slpmsg->buffer); #ifdef MSN_DEBUG_SLP /* if (slpmsg->info != NULL) g_free(slpmsg->info); */ #endif for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) { /* Something is pointing to this slpmsg, so we should remove that * pointer to prevent a crash. */ /* Ex: a user goes offline and after that we receive an ACK */ MsnMessage *msg = cur->data; #ifdef MSN_DEBUG_SLPMSG gaim_debug_info("msn", "Unlink slpmsg callbacks.\n"); #endif msg->ack_cb = NULL; msg->nak_cb = NULL; msg->ack_data = NULL; } slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); g_free(slpmsg); } void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, long long size) { if (body != NULL) slpmsg->buffer = g_memdup(body, size); else slpmsg->buffer = g_new0(char, size); slpmsg->size = size; } void msn_slpmsg_open_file(MsnSlpMessage *slpmsg, const char *file_name) { struct stat st; slpmsg->fp = g_fopen(file_name, "rb"); if (g_stat(file_name, &st) == 0) slpmsg->size = st.st_size; } #ifdef MSN_DEBUG_SLP const void msn_slpmsg_show(MsnMessage *msg) { const char *info; gboolean text; guint32 flags; text = FALSE; flags = GUINT32_TO_LE(msg->msnslp_header.flags); switch (flags) { case 0x0: info = "SLP CONTROL"; text = TRUE; break; case 0x2: info = "SLP ACK"; break; case 0x20: case 0x1000030: info = "SLP DATA"; break; default: info = "SLP UNKNOWN"; break; } msn_message_show_readable(msg, info, text); } #endif MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, const char *header, const char *branch, const char *content_type, const char *content) { MsnSlpLink *slplink; MsnSlpMessage *slpmsg; char *body; gsize body_len; gsize content_len; g_return_val_if_fail(slpcall != NULL, NULL); g_return_val_if_fail(header != NULL, NULL); slplink = slpcall->slplink; /* Let's remember that "content" should end with a 0x00 */ content_len = (content != NULL) ? strlen(content) + 1 : 0; body = g_strdup_printf( "%s\r\n" "To: <msnmsgr:%s>\r\n" "From: <msnmsgr:%s>\r\n" "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" "CSeq: %d\r\n" "Call-ID: {%s}\r\n" "Max-Forwards: 0\r\n" "Content-Type: %s\r\n" "Content-Length: %" G_GSIZE_FORMAT "\r\n" "\r\n", header, slplink->remote_user, slplink->local_user, branch, cseq, slpcall->id, content_type, content_len); body_len = strlen(body); if (content_len > 0) { body_len += content_len; body = g_realloc(body, body_len); g_strlcat(body, content, body_len); } slpmsg = msn_slpmsg_new(slplink); msn_slpmsg_set_body(slpmsg, body, body_len); slpmsg->sip = TRUE; slpmsg->slpcall = slpcall; g_free(body); return slpmsg; }
