--- jabberd2-2.0s11/sm/mod_iq_vcard.c 2005-03-23 18:01:25.000000000 +0000 +++ jabberd2-2.0s11/sm/mod_iq_vcard.c 2007-12-27 15:20:05.000000000 +0000 @@ -36,24 +36,49 @@ static char *_iq_vcard_map[] = { "FN", "fn", + "N/FAMILY", "n-family", + "N/GIVEN", "n-given", + "N/MIDDLE", "n-middle", + "N/PREFIX", "n-prefix", + "N/SUFFIX", "n-suffix", "NICKNAME", "nickname", - "URL", "url", - "TEL/NUMBER", "tel", - "EMAIL/USERID", "email", - "TITLE", "title", - "ROLE", "role", + "PHOTO/TYPE", "photo-type", + "PHOTO/BINVAL", "photo-binval", + "PHOTO/EXTVAL", "photo-extval", "BDAY", "bday", - "DESC", "desc", - "N/GIVEN", "n-given", - "N/FAMILY", "n-family", - "ADR/STREET", "adr-street", + "ADR/POBOX", "adr-pobox", "ADR/EXTADD", "adr-extadd", + "ADR/STREET", "adr-street", "ADR/LOCALITY", "adr-locality", "ADR/REGION", "adr-region", "ADR/PCODE", "adr-pcode", "ADR/CTRY", "adr-country", + "TEL/NUMBER", "tel", + "EMAIL/USERID", "email", + "JABBERID", "jabberid", + "MAILER", "mailer", + "TZ", "tz", + "GEO/LAT", "geo-lat", + "GEO/LON", "geo-lon", + "TITLE", "title", + "ROLE", "role", + "LOGO/TYPE", "logo-type", + "LOGO/BINVAL", "logo-binval", + "LOGO/EXTVAL", "logo-extval", + "AGENT/EXTVAL", "agent-extval", "ORG/ORGNAME", "org-orgname", "ORG/ORGUNIT", "org-orgunit", + "NOTE", "note", + "REV", "rev", + "SORT-STRING", "sort-string", + "SOUND/PHONETIC","sound-phonetic", + "SOUND/BINVAL", "sound-binval", + "SOUND/EXTVAL", "sound-extval", + "UID", "uid", + "URL", "url", + "DESC", "desc", + "KEY/TYPE", "key-type", + "KEY/CRED", "key-cred", NULL, NULL }; @@ -220,6 +245,59 @@ return mod_HANDLED; } +/* for the special JID of your jabber server bare domain. + * You can have one for every virtual host + * you can populate it using your DBMS frontend + */ +static mod_ret_t _iq_vcard_pkt_sm(mod_instance_t mi, pkt_t pkt) { + os_t os; + st_ret_t ret; + pkt_t result; + + /* only handle vcard sets and gets */ + if((pkt->type != pkt_IQ && pkt->type != pkt_IQ_SET) || pkt->ns != ns_VCARD) + return mod_PASS; + + /* error them if they're trying to do a set */ + if(pkt->type == pkt_IQ_SET) + return -stanza_err_FORBIDDEN; + + /* a vcard for the server */ + ret = storage_get(mi->sm->st, "vcard", pkt->to->domain, NULL, &os); + switch(ret) { + case st_FAILED: + return -stanza_err_INTERNAL_SERVER_ERROR; + + case st_NOTIMPL: + return -stanza_err_FEATURE_NOT_IMPLEMENTED; + + case st_NOTFOUND: + return -stanza_err_ITEM_NOT_FOUND; + + case st_SUCCESS: + result = _iq_vcard_to_pkt(mi->sm, os); + os_free(os); + + result->to = jid_dup(pkt->from); + result->from = jid_dup(pkt->to); + + nad_set_attr(result->nad, 1, -1, "to", jid_full(result->to), 0); + nad_set_attr(result->nad, 1, -1, "from", jid_full(result->from), 0); + + pkt_id(pkt, result); + + pkt_router(result); + + pkt_free(pkt); + + return mod_HANDLED; + } + + /* we never get here */ + pkt_free(pkt); + return mod_HANDLED; +} + static mod_ret_t _iq_vcard_pkt_user(mod_instance_t mi, user_t user, pkt_t pkt) { os_t os; st_ret_t ret; @@ -279,6 +357,7 @@ if(mod->init) return 0; + mod->pkt_sm = _iq_vcard_pkt_sm; mod->in_sess = _iq_vcard_in_sess; mod->pkt_user = _iq_vcard_pkt_user; mod->user_delete = _iq_vcard_user_delete; --- jabberd2-2.0s11/etc/sm.xml.dist.in 2005-04-14 19:27:07.000000000 +0100 +++ jabberd2-2.0s11/etc/sm.xml.dist.in 2007-12-27 15:25:33.000000000 +0000 @@ -249,6 +249,7 @@ to JID has no node part). This is normally used to provide session-manager-wide services (like service discovery). --> + iq-vcard iq-last iq-time iq-version --- jabberd2-2.0s11/sm/storage_mysql.c 2005-06-22 21:32:05.000000000 +0100 +++ jabberd2-2.0s11/sm/storage_mysql.c 2007-12-27 22:30:31.000000000 +0000 @@ -557,7 +557,7 @@ /* Set mysql_options for client ver 3.23.50 or later (workaround for mysql bug in 3.23.49) */ mysql_options(conn, MYSQL_READ_DEFAULT_GROUP, "jabberd"); #endif - + mysql_options(conn, MYSQL_SET_CHARSET_NAME, "utf8"); /* connect with CLIENT_INTERACTIVE to get a (possibly) higher timeout value than default */ if(mysql_real_connect(conn, host, user, pass, dbname, atoi(port), NULL, CLIENT_INTERACTIVE) == NULL) { log_write(drv->st->sm->log, LOG_ERR, "mysql: connection to database failed: %s", mysql_error(conn)); --- jabberd2-2.0s11/c2s/authreg_mysql.c 2005-06-22 21:32:05.000000000 +0100 +++ jabberd2-2.0s11/c2s/authreg_mysql.c 2007-12-27 22:35:19.000000000 +0000 @@ -519,7 +519,7 @@ /* Set mysql_options for client ver 3.23.50 or later (workaround for mysql bug in 3.23.49) */ mysql_options(conn, MYSQL_READ_DEFAULT_GROUP, "jabberd"); #endif - + mysql_options(conn, MYSQL_SET_CHARSET_NAME, "utf8"); /* connect with CLIENT_INTERACTIVE to get a (possibly) higher timeout value than default */ if(mysql_real_connect(conn, host, user, pass, dbname, atoi(port), NULL, CLIENT_INTERACTIVE) == NULL) { log_write(ar->c2s->log, LOG_ERR, "mysql: connection to database failed: %s", mysql_error(conn)); --- jabberd2-2.0s11/debian/control 2007-12-27 22:42:56.000000000 +0000 +++ jabberd2-2.0s11/debian/control 2007-12-27 22:42:06.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Jamin W. Collins Uploaders: Andres Salomon -Build-Depends: dpatch, libssl-dev (>= 0.9.6), libdb4.2-dev, debhelper (>> 4.0.0), postgresql-dev, libmysqlclient15-dev, libpam0g-dev, libldap2-dev, libidn11-dev +Build-Depends: dpatch, libssl-dev (>= 0.9.6), libdb-dev, debhelper (>> 4.0.0), libpq-dev, libmysqlclient15-dev, libpam0g-dev, libldap2-dev, libidn11-dev Standards-Version: 3.6.1.0 Package: jabberd2-bdb --- jabberd2-2.0s11/debian/rules 2007-12-27 15:21:48.000000000 +0000 +++ jabberd2-2.0s11/debian/rules 2007-12-27 23:20:53.000000000 +0000 @@ -118,7 +118,7 @@ touch config-ldap-pgsql -build: build-bdb build-mysql build-pgsql build-ldap-bdb build-ldap-mysql build-ldap-pgsql +build: build-bdb build-pgsql build-ldap-bdb build-ldap-mysql build-ldap-pgsql build-mysql touch build build-bdb: config-bdb patch-stamp