Mercurial > pidgin.yaz
comparison plugins/raw.c @ 12019:4c05f4dd3ab9
[gaim-migrate @ 14312]
*** empty log message ***
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 09 Nov 2005 02:59:02 +0000 |
parents | bb0d7b719af2 |
children | 440d9354b67f |
comparison
equal
deleted
inserted
replaced
12018:014c22dd9d06 | 12019:4c05f4dd3ab9 |
---|---|
1 #define GAIM_PLUGINS | 1 /* |
2 * Gaim - Replace certain misspelled words with their correct form. | |
3 * | |
4 * Signification changes were made by Benjamin Kahn ("xkahn") and | |
5 * Richard Laager ("rlaager") in April 2005--you may want to contact | |
6 * them if you have questions. | |
7 * | |
8 * Gaim is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 * | |
26 */ | |
27 | |
28 #include "internal.h" | |
29 #include "gtkgaim.h" | |
30 | |
2 #include "conversation.h" | 31 #include "conversation.h" |
3 #include "debug.h" | 32 #include "debug.h" |
4 #include "prpl.h" | 33 #include "prpl.h" |
5 #include "version.h" | 34 #include "version.h" |
6 | 35 |
7 #include "gtkgaim.h" | |
8 #include "gtkplugin.h" | 36 #include "gtkplugin.h" |
9 #include "gtkutils.h" | 37 #include "gtkutils.h" |
10 | 38 |
11 #ifdef MAX | 39 #ifdef MAX |
12 # undef MAX | 40 # undef MAX |
13 # undef MIN | 41 # undef MIN |
14 #endif | 42 #endif |
15 | |
16 #include "protocols/jabber/jabber.h" | |
17 #undef GAIM_PLUGINS | |
18 #include "protocols/msn/session.h" | |
19 | 43 |
20 #define RAW_PLUGIN_ID "gtk-raw" | 44 #define RAW_PLUGIN_ID "gtk-raw" |
21 | 45 |
22 static GtkWidget *window = NULL; | 46 static GtkWidget *window = NULL; |
23 static GaimAccount *account = NULL; | 47 static GaimAccount *account = NULL; |
44 gc = gaim_account_get_connection(account); | 68 gc = gaim_account_get_connection(account); |
45 | 69 |
46 txt = gtk_entry_get_text(entry); | 70 txt = gtk_entry_get_text(entry); |
47 | 71 |
48 prpl_id = gaim_account_get_protocol_id(account); | 72 prpl_id = gaim_account_get_protocol_id(account); |
49 | 73 |
50 gaim_debug_misc("raw", "prpl_id = %s\n", prpl_id); | 74 gaim_debug_misc("raw", "prpl_id = %s\n", prpl_id); |
51 | 75 |
52 if (strcmp(prpl_id, "prpl-toc") == 0) { | 76 if (strcmp(prpl_id, "prpl-toc") == 0) { |
53 int *a = (int *)gc->proto_data; | 77 int *a = (int *)gc->proto_data; |
54 unsigned short seqno = htons(a[1]++ & 0xffff); | 78 unsigned short seqno = htons(a[1]++ & 0xffff); |
55 unsigned short len = htons(strlen(txt) + 1); | 79 unsigned short len = htons(strlen(txt) + 1); |
56 write(*a, "*\002", 2); | 80 write(*a, "*\002", 2); |
57 write(*a, &seqno, 2); | 81 write(*a, &seqno, 2); |
58 write(*a, &len, 2); | 82 write(*a, &len, 2); |
59 write(*a, txt, ntohs(len)); | 83 write(*a, txt, ntohs(len)); |
60 gaim_debug(GAIM_DEBUG_MISC, "raw", "TOC C: %s\n", txt); | 84 gaim_debug(GAIM_DEBUG_MISC, "raw", "TOC C: %s\n", txt); |
61 | |
62 } else if (strcmp(prpl_id, "prpl-msn") == 0) { | |
63 MsnSession *session = gc->proto_data; | |
64 char buf[strlen(txt) + 3]; | |
65 | 85 |
66 g_snprintf(buf, sizeof(buf), "%s\r\n", txt); | |
67 msn_servconn_write(session->notification->servconn, buf, strlen(buf)); | |
68 | |
69 } else if (strcmp(prpl_id, "prpl-irc") == 0) { | 86 } else if (strcmp(prpl_id, "prpl-irc") == 0) { |
70 write(*(int *)gc->proto_data, txt, strlen(txt)); | 87 write(*(int *)gc->proto_data, txt, strlen(txt)); |
71 write(*(int *)gc->proto_data, "\r\n", 2); | 88 write(*(int *)gc->proto_data, "\r\n", 2); |
72 gaim_debug(GAIM_DEBUG_MISC, "raw", "IRC C: %s\n", txt); | 89 gaim_debug(GAIM_DEBUG_MISC, "raw", "IRC C: %s\n", txt); |
73 | 90 |
74 } else if (strcmp(prpl_id, "prpl-jabber") == 0) { | |
75 jabber_send_raw((JabberStream *)gc->proto_data, txt, -1); | |
76 } else { | 91 } else { |
77 gaim_debug_error("raw", "Unknown protocol ID %s\n", prpl_id); | 92 gaim_debug_error("raw", "Unknown protocol ID %s\n", prpl_id); |
78 } | 93 } |
79 | 94 |
80 gtk_entry_set_text(entry, ""); | 95 gtk_entry_set_text(entry, ""); |
149 GAIM_PRIORITY_DEFAULT, | 164 GAIM_PRIORITY_DEFAULT, |
150 RAW_PLUGIN_ID, | 165 RAW_PLUGIN_ID, |
151 N_("Raw"), | 166 N_("Raw"), |
152 VERSION, | 167 VERSION, |
153 N_("Lets you send raw input to text-based protocols."), | 168 N_("Lets you send raw input to text-based protocols."), |
154 N_("Lets you send raw input to text-based protocols (Jabber, MSN, IRC, " | 169 N_("Lets you send raw input to text-based protocols (IRC, " |
155 "TOC). Hit 'Enter' in the entry box to send. Watch the debug window."), | 170 "TOC). Hit 'Enter' in the entry box to send. Watch the debug window."), |
156 "Eric Warmenhoven <eric@warmenhoven.org>", | 171 "Eric Warmenhoven <eric@warmenhoven.org>", |
157 GAIM_WEBSITE, | 172 GAIM_WEBSITE, |
158 plugin_load, | 173 plugin_load, |
159 plugin_unload, | 174 plugin_unload, |