Mercurial > pidgin
comparison libpurple/protocols/irc/msgs.c @ 32785:f911cdafdcd8
changelog WHO fix
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 03 May 2012 13:14:51 +0000 |
parents | 665388a0f573 |
children | 31e66fce43d1 900f6ee1188e |
comparison
equal
deleted
inserted
replaced
32784:665388a0f573 | 32785:f911cdafdcd8 |
---|---|
110 irc_blist_timeout(irc); | 110 irc_blist_timeout(irc); |
111 if (!irc->timer) | 111 if (!irc->timer) |
112 irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); | 112 irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); |
113 } | 113 } |
114 | 114 |
115 /* This function is ugly, but it's really an error handler. */ | |
115 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) | 116 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) |
116 { | 117 { |
117 char *clean; | 118 int i, directed_magic = TRUE; |
119 char *convname, *end, *tmp, *cur; | |
120 PurpleConversation *convo; | |
121 | |
122 for (cur = args[0], i = 0; i < 4; i++) { | |
123 end = strchr(cur, ' '); | |
124 if (cur == NULL) { | |
125 goto undirected; | |
126 } | |
127 /* Check for 3-digit numeric in second position */ | |
128 if (i == 1 && (end - cur != 3 | |
129 || !isdigit(cur[0]) || !isdigit(cur[1]) | |
130 || !isdigit(cur[2]))) { | |
131 goto undirected; | |
132 } | |
133 /* Hack! */ | |
134 if (i != 3) { | |
135 cur = end + 1; | |
136 } | |
137 } | |
138 | |
139 /* At this point, cur is the beginning of the fourth position, | |
140 * end is the following space, and there are remaining | |
141 * arguments. We'll check to see if this argument is a | |
142 * currently active conversation (private message or channel, | |
143 * either one), and print the numeric to that conversation if it | |
144 * is. */ | |
145 | |
146 tmp = g_strndup(cur, end - cur); | |
147 convname = purple_utf8_salvage(tmp); | |
148 g_free(tmp); | |
149 | |
150 /* Check for an existing conversation */ | |
151 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, | |
152 convname, | |
153 irc->account); | |
154 g_free(convname); | |
155 | |
156 if (convo == NULL) { | |
157 goto undirected; | |
158 } | |
159 | |
160 tmp = purple_utf8_salvage(args[0]); | |
161 purple_conversation_write(convo, "", tmp, | |
162 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG | |
163 |PURPLE_MESSAGE_RAW|PURPLE_MESSAGE_NO_LINKIFY, | |
164 time(NULL)); | |
165 g_free(tmp); | |
166 return; | |
167 | |
168 undirected: | |
118 /* This, too, should be escaped somehow (smarter) */ | 169 /* This, too, should be escaped somehow (smarter) */ |
119 clean = purple_utf8_salvage(args[0]); | 170 tmp = purple_utf8_salvage(args[0]); |
120 purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean); | 171 purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", tmp); |
121 g_free(clean); | 172 g_free(tmp); |
122 } | 173 } |
123 | 174 |
124 void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args) | 175 void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args) |
125 { | 176 { |
126 gchar **features; | 177 gchar **features; |