+ net_hook_t* new_hook;
+ GString* str;
+ str = (GString*) hook->data;
+ g_string_append_len (str, buffer, len);
+ if (str->len >= 7)
+ {
+ if (!strncmp (str->str, "<stream", 7))
+ {
+ /* Connection is a Jabber client */
+ g_debug ("Connection from %s is a Jabber client.",
+ hook->conn->hostname);
+ new_hook = jabber_hook_new (hook->conn);
+ new_hook->read (new_hook, str->str, str->len);
+ proto_detect_destroy (hook);
+ }
+ else
+ {
+ g_debug ("Unrecognized protocol from %s.",
+ hook->conn->hostname);
+ gnet_conn_disconnect (hook->conn);
+ gnet_conn_unref (hook->conn);
+ proto_detect_destroy (hook);
+ }
+ }