aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorkenobi <kenobi@rhea>2007-12-19 00:59:35 +0100
committerkenobi <kenobi@rhea>2007-12-19 00:59:35 +0100
commiteded1f703a8f5d2272b9d294d8e3dfb48fa302b4 (patch)
tree9f372f50d123a258640c91a6dc3c027d9c8df4aa /protocols
parentdc0ba9c85539533349353713162f94077fb27be3 (diff)
Merged in 280..288 from upstream (e.g. PING)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/conference.c21
-rw-r--r--protocols/jabber/io.c4
-rw-r--r--protocols/jabber/iq.c12
-rw-r--r--protocols/jabber/jabber.c16
-rw-r--r--protocols/jabber/jabber.h2
-rw-r--r--protocols/msn/msn.c2
-rw-r--r--protocols/oscar/aim.h2
-rw-r--r--protocols/oscar/oscar.c28
-rw-r--r--protocols/yahoo/yahoo.c2
9 files changed, 59 insertions, 30 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c
index c5bc0e68..074412ec 100644
--- a/protocols/jabber/conference.c
+++ b/protocols/jabber/conference.c
@@ -175,6 +175,27 @@ int jabber_chat_leave( struct groupchat *c, const char *reason )
return 1;
}
+void jabber_chat_invite( struct groupchat *c, char *who, char *message )
+{
+ struct xt_node *node;
+ struct im_connection *ic = c->ic;
+ struct jabber_chat *jc = c->data;
+
+ node = xt_new_node( "reason", message, NULL );
+
+ node = xt_new_node( "invite", NULL, node );
+ xt_add_attr( node, "to", who );
+
+ node = xt_new_node( "x", NULL, node );
+ xt_add_attr( node, "xmlns", XMLNS_MUC_USER );
+
+ node = jabber_make_packet( "message", NULL, jc->name, node );
+
+ jabber_write_packet( ic, node );
+
+ xt_free_node( node );
+}
+
/* Not really the same syntax as the normal pkt_ functions, but this isn't
called by the xmltree parser directly and this way I can add some extra
parameters so we won't have to repeat too many things done by the caller
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index 61cd142e..29561b86 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -119,7 +119,7 @@ static gboolean jabber_write_queue( struct im_connection *ic )
return TRUE;
}
- else if( st == 0 || ( st < 0 && !sockerr_again() ) )
+ else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
{
/* Set fd to -1 to make sure we won't write to it anymore. */
closesocket( jd->fd ); /* Shouldn't be necessary after errors? */
@@ -230,7 +230,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
}
}
}
- else if( st == 0 || ( st < 0 && !sockerr_again() ) )
+ else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
{
closesocket( jd->fd );
jd->fd = -1;
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 8bd1111a..2f0959b0 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -49,7 +49,8 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
}
else if( strcmp( type, "get" ) == 0 )
{
- if( !( c = xt_find_node( node->children, "query" ) ) ||
+ if( !( ( c = xt_find_node( node->children, "query" ) ) ||
+ ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */
!( s = xt_find_attr( c, "xmlns" ) ) )
{
imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
@@ -80,12 +81,21 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
strftime( buf, sizeof( buf ) - 1, "%Z", localtime( &time_ep ) );
xt_add_child( reply, xt_new_node( "tz", buf, NULL ) );
}
+ else if( strcmp( s, XMLNS_PING ) == 0 )
+ {
+ xt_free_node( reply );
+ reply = jabber_make_packet( "iq", "result", xt_find_attr( node, "from" ), NULL );
+ if( ( s = xt_find_attr( node, "id" ) ) )
+ xt_add_attr( reply, "id", s );
+ pack = 0;
+ }
else if( strcmp( s, XMLNS_DISCO_INFO ) == 0 )
{
const char *features[] = { XMLNS_VERSION,
XMLNS_TIME,
XMLNS_CHATSTATES,
XMLNS_MUC,
+ XMLNS_PING,
XMLNS_SI,
XMLNS_BYTESTREAMS,
XMLNS_FILETRANSFER,
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 98d2dadf..1d3225dd 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -422,6 +422,20 @@ static void jabber_chat_leave_( struct groupchat *c )
jabber_chat_leave( c, NULL );
}
+static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg )
+{
+ struct jabber_chat *jc = c->data;
+ gchar *msg_alt = NULL;
+
+ if( msg == NULL )
+ msg_alt = g_strdup_printf( "%s invited you to %s", c->ic->acc->user, jc->name );
+
+ if( c && who )
+ jabber_chat_invite( c, who, msg ? msg : msg_alt );
+
+ g_free( msg_alt );
+}
+
static void jabber_keepalive( struct im_connection *ic )
{
/* Just any whitespace character is enough as a keepalive for XMPP sessions. */
@@ -493,7 +507,7 @@ void jabber_initmodule()
ret->remove_buddy = jabber_remove_buddy;
ret->chat_msg = jabber_chat_msg_;
ret->chat_topic = jabber_chat_topic_;
-// ret->chat_invite = jabber_chat_invite;
+ ret->chat_invite = jabber_chat_invite_;
ret->chat_leave = jabber_chat_leave_;
ret->chat_join = jabber_chat_join_;
ret->keepalive = jabber_keepalive;
diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h
index 9edb844e..3251b49b 100644
--- a/protocols/jabber/jabber.h
+++ b/protocols/jabber/jabber.h
@@ -188,6 +188,7 @@ struct jabber_transfer
#define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */
#define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */
#define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */
+#define XMLNS_PING "urn:xmpp:ping" /* XEP-0199 */
#define XMLNS_VCARD "vcard-temp" /* XEP-0054 */
#define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */
#define XMLNS_XDATA "jabber:x:data" /* XEP-0004 */
@@ -292,5 +293,6 @@ int jabber_chat_topic( struct groupchat *c, char *topic );
int jabber_chat_leave( struct groupchat *c, const char *reason );
void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
+void jabber_chat_invite( struct groupchat *c, char *who, char *message );
#endif
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index df04e30d..aa05dbdd 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -240,7 +240,7 @@ static void msn_chat_msg( struct groupchat *c, char *message, int flags )
already severely broken) disappeared here! */
}
-static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
+static void msn_chat_invite( struct groupchat *c, char *who, char *message )
{
struct msn_switchboard *sb = msn_sb_by_chat( c );
char buf[1024];
diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h
index 81ea5f9e..9516996c 100644
--- a/protocols/oscar/aim.h
+++ b/protocols/oscar/aim.h
@@ -93,7 +93,7 @@ typedef guint16 flap_seqnum_t;
* the client to connect to it.
*
*/
-#define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
+#define AIM_DEFAULT_LOGIN_SERVER "login.messaging.aol.com"
#define AIM_LOGIN_PORT 5190
/*
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 96983738..c4683046 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -340,7 +340,7 @@ static void oscar_init(account_t *acc)
{
set_t *s;
- s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
+ s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );
s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
if (isdigit(acc->user[0])) {
@@ -355,15 +355,7 @@ static void oscar_login(account_t *acc) {
struct im_connection *ic = imcb_new(acc);
struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
- if (isdigit(acc->user[0])) {
- odata->icq = TRUE;
- /* This is odd but it's necessary for a proper do_import and do_export.
- We don't do those anymore, but let's stick with it, just in case
- it accidentally fixes something else too... </bitlbee> */
- /* ic->acc->pass[8] = 0;
- Not touching this anymore now that it belongs to account_t!
- Let's hope nothing will break. ;-) */
- } else {
+ if (!isdigit(acc->user[0])) {
ic->flags |= OPT_DOES_HTML;
}
@@ -384,24 +376,14 @@ static void oscar_login(account_t *acc) {
return;
}
- if (acc->server == NULL) {
- imcb_error(ic, "No servername specified");
- imc_logout(ic, FALSE);
- return;
- }
-
- if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
- g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
- imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
- }
-
imcb_log(ic, _("Signon: %s"), ic->acc->user);
aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
conn->status |= AIM_CONN_STATUS_INPROGRESS;
- conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
+ conn->fd = proxy_connect(set_getstr(&acc->set, "server"),
+ AIM_LOGIN_PORT, oscar_login_connect, ic);
if (conn->fd < 0) {
imcb_error(ic, _("Couldn't connect to host"));
imc_logout(ic, TRUE);
@@ -2508,7 +2490,7 @@ void oscar_chat_msg(struct groupchat *c, char *message, int msgflags)
/* return (ret >= 0); */
}
-void oscar_chat_invite(struct groupchat *c, char *message, char *who)
+void oscar_chat_invite(struct groupchat *c, char *who, char *message)
{
struct im_connection *ic = c->ic;
struct oscar_data * od = (struct oscar_data *)ic->proto_data;
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index 28a72877..625f3d1c 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -305,7 +305,7 @@ static void byahoo_chat_msg( struct groupchat *c, char *message, int flags )
yahoo_conference_message( yd->y2_id, NULL, c->data, c->title, message, 1 );
}
-static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who )
+static void byahoo_chat_invite( struct groupchat *c, char *who, char *msg )
{
struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;