Mercurial > pidgin
annotate src/protocols/msn/command.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 | ab6636c5a136 |
| children | a1aa681f1448 |
| rev | line source |
|---|---|
| 8810 | 1 /** |
| 2 * @file command.c MSN command functions | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
|
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
| 8810 | 9 * |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
| 12 * the Free Software Foundation; either version 2 of the License, or | |
| 13 * (at your option) any later version. | |
| 14 * | |
| 15 * This program is distributed in the hope that it will be useful, | |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 * GNU General Public License for more details. | |
| 19 * | |
| 20 * You should have received a copy of the GNU General Public License | |
| 21 * along with this program; if not, write to the Free Software | |
| 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 */ | |
| 24 #include "msn.h" | |
| 25 #include "command.h" | |
| 26 | |
| 27 gboolean | |
| 28 is_num(char *str) | |
| 29 { | |
| 30 char *c; | |
| 31 for (c = str; *c; c++) { | |
| 32 if (!(g_ascii_isdigit(*c))) | |
| 33 return FALSE; | |
| 34 } | |
| 35 | |
| 36 return TRUE; | |
| 37 } | |
| 38 | |
| 39 MsnCommand * | |
| 40 msn_command_from_string(const char *string) | |
| 41 { | |
| 42 MsnCommand *cmd; | |
| 43 char *tmp; | |
| 44 char *param_start; | |
| 45 | |
| 46 g_return_val_if_fail(string != NULL, NULL); | |
| 47 | |
| 48 tmp = g_strdup(string); | |
| 49 param_start = strchr(tmp, ' '); | |
| 50 | |
| 51 cmd = g_new0(MsnCommand, 1); | |
| 52 cmd->command = tmp; | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
53 |
| 8810 | 54 if (param_start) |
| 55 { | |
| 56 char *param; | |
| 57 int c; | |
| 58 | |
| 59 *param_start++ = '\0'; | |
| 60 cmd->params = g_strsplit(param_start, " ", 0); | |
| 61 | |
| 62 for (c = 0; cmd->params[c]; c++); | |
| 63 cmd->param_count = c; | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
64 |
| 8810 | 65 param = cmd->params[0]; |
| 66 | |
| 67 cmd->trId = is_num(param) ? atoi(param) : 0; | |
| 68 } | |
| 69 else | |
| 70 cmd->trId = 0; | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
71 |
| 8810 | 72 msn_command_ref(cmd); |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
73 |
| 8810 | 74 return cmd; |
| 75 } | |
| 76 | |
| 77 void | |
| 78 msn_command_destroy(MsnCommand *cmd) | |
| 79 { | |
| 80 g_return_if_fail(cmd != NULL); | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
81 |
| 8810 | 82 if (cmd->ref_count > 0) |
| 83 { | |
| 84 msn_command_unref(cmd); | |
| 85 return; | |
| 86 } | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8810
diff
changeset
|
87 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8810
diff
changeset
|
88 if (cmd->payload != NULL) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8810
diff
changeset
|
89 g_free(cmd->payload); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8810
diff
changeset
|
90 |
| 8810 | 91 g_free(cmd->command); |
| 92 g_strfreev(cmd->params); | |
| 93 g_free(cmd); | |
| 94 } | |
| 95 | |
| 96 MsnCommand * | |
| 97 msn_command_ref(MsnCommand *cmd) | |
| 98 { | |
| 99 g_return_val_if_fail(cmd != NULL, NULL); | |
| 100 | |
| 101 cmd->ref_count++; | |
| 102 return cmd; | |
| 103 } | |
| 104 | |
| 105 MsnCommand * | |
| 106 msn_command_unref(MsnCommand *cmd) | |
| 107 { | |
| 108 g_return_val_if_fail(cmd != NULL, NULL); | |
| 109 | |
| 110 if (cmd->ref_count <= 0) | |
| 111 return NULL; | |
| 112 | |
| 113 cmd->ref_count--; | |
| 114 | |
| 115 if (cmd->ref_count == 0) | |
| 116 { | |
| 117 msn_command_destroy(cmd); | |
| 118 return NULL; | |
| 119 } | |
| 120 | |
| 121 return cmd; | |
| 122 } |
