changeset 1610:6db9f403f707

Replace 'username' with 'jid' in the configuration file The previous behaviour doesn't make much sense anymore. MCabber does DNS SRV lookups so providing the server name is usually not needed.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 11 Oct 2009 20:06:47 +0200
parents af5bdd167b04
children f9bf561e54d0
files mcabber/ChangeLog mcabber/NEWS mcabber/mcabberrc.example mcabber/src/main.c mcabber/src/xmpp.c
diffstat 5 files changed, 38 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/ChangeLog	Sun Oct 11 16:48:15 2009 +0200
+++ b/mcabber/ChangeLog	Sun Oct 11 20:06:47 2009 +0200
@@ -1,6 +1,8 @@
 mcabber (0.10.0-dev)
 
  * Switch to the Loudmouth library (franky)
+ * MCabber can now do DNS SRV lookups so the variable
+   'username' has been replaced with 'jid' in the configuration file
  * Add support for modules in mcabber (Myhailo Danylenko)
  * Message Receipts (XEP-0184) support (franky)
  * Update of Entity Capabilities support (franky)
--- a/mcabber/NEWS	Sun Oct 11 16:48:15 2009 +0200
+++ b/mcabber/NEWS	Sun Oct 11 20:06:47 2009 +0200
@@ -1,6 +1,8 @@
 mcabber (0.10.0)
 
  * MCabber now uses the Loudmouth library (version 1.4.3 or greater).
+ * The JID should be provided in the configuration file, the variable
+   'username' has been replaced with 'jid'.
 
  -- Mikael, ?
 
--- a/mcabber/mcabberrc.example	Sun Oct 11 16:48:15 2009 +0200
+++ b/mcabber/mcabberrc.example	Sun Oct 11 20:06:47 2009 +0200
@@ -4,29 +4,27 @@
 # - Leading and trailing spaces are ignored.
 # - Empty lines and lines beginning with a '#' are ignored.
 
-# The jid will be the following: username@server
-# If your jid's domain name is different from the server name,
-# you can specify your complete jid as username.
-#
+# Please provide your Jabber (XMPP) identifier:
+set jid = yourusername@domain
+
 # If password is not given, it will be interactively asked for.
-# If port is not given, default Jabber port will be used.
-#
-# Warning to GTalk users! please see the FAQ:
-# <http://wiki.mcabber.com/index.php/Frequently_Asked_Questions>
-
-set username = yourusername
 # Note: if the password contains leading or trailing spaces, you must
 # enclose it with quotes: set password = " example password "
 #set password = yourpassword
-set server = your.jabber.server
+
+# You can provide a server name if you want mcabber to connect
+# to a specific server.
+#set server = your.jabber.server
+
+# If port is not given, mcabber will try to find it out.
 #set port = 5222
-#
+
 # If you don't know what a resource is, do not set it.
 # Set disable_random_resource to 1 if you don't want mcabber to add a random
 # suffix to the resource name.
 #set resource = mcabber
 #set disable_random_resource = 0
-#
+
 #set priority = 3
 #set priority_away = 0
 
@@ -47,7 +45,7 @@
 # 1. gnutls-cli -p 5223 $your_server
 # 2. openssl s_client -connect $your_server:5223 | \
 #    openssl x509 -fingerprint -md5 -noout
-set ssl_fingerprint = 97:5C:00:3F:1D:77:45:25:E2:C5:70:EC:83:C8:87:EE
+#set ssl_fingerprint = 97:5C:00:3F:1D:77:45:25:E2:C5:70:EC:83:C8:87:EE
 # Set ssl_ignore_checks to 1 to disable all certificate checks except the
 # fingerprint check.
 #set ssl_ignore_checks = 0
@@ -72,7 +70,7 @@
 # Conference nickname
 # This nickname is used when joining a room, when no nick is explicitly
 # specified by the user.  Note that when the nickname option is not set,
-# the username variable can be used.
+# the jid variable can be used.
 #set nickname = Abitbol
 
 # Proxy
@@ -388,15 +386,15 @@
 #set roster_win_on_right = 0
 #
 # By default, the displayed name of a contact in the roster window will
-# be the jid if no name has been specified.  You can use the following
+# be the JID if no name has been specified.  You can use the following
 # option if you only want to see the username part.
 #set roster_hide_domain = 0
 #
 # Buddy name format (in status window):
 # - 0: (default) "<jid/resource>"
-# - 1: "name <jid/resource>" (name is omitted if same as the jid)
-# - 2: "name/resource" (if the name is the same as the jid, use <jid/res>)
-# - 3: "name" (if the name is the same as the jid, use <jid/res>)
+# - 1: "name <jid/resource>" (name is omitted if same as the JID)
+# - 2: "name/resource" (if the name is the same as the JID, use <jid/res>)
+# - 3: "name" (if the name is the same as the JID, use <jid/res>)
 #set buddy_format = 2
 #
 # Time format:
@@ -406,8 +404,8 @@
 #set time_prefix = 0
 #
 # When a contact sends "/me ", mcabber displays "*user ", where user
-# is the local part of the contact's jid.
-# If you want mcabber to display the complete bare jid (user@server.com),
+# is the local part of the contact's JID.
+# If you want mcabber to display the complete bare JID (user@server.com),
 # set 'buddy_me_fulljid' to 1 (default: 0)
 #set buddy_me_fulljid = 1
 #
@@ -419,7 +417,7 @@
 # Values:  0: never  1: only connect/disconnect  2: all
 #set show_status_in_buffer = 1
 #
-# Set 'log_display_sender' to 1 to display the message sender's jid in the
+# Set 'log_display_sender' to 1 to display the message sender's JID in the
 # log window (default: 0, no)
 #set log_display_sender = 0
 #
--- a/mcabber/src/main.c	Sun Oct 11 16:48:15 2009 +0200
+++ b/mcabber/src/main.c	Sun Oct 11 20:06:47 2009 +0200
@@ -340,15 +340,15 @@
 
   /* If no password is stored, we ask for it before entering
      ncurses mode -- unless the username is unknown. */
-  if (settings_opt_get("username") && !settings_opt_get("password")) {
+  if (settings_opt_get("jid") && !settings_opt_get("password")) {
     const char *p;
     char *pwd;
     p = settings_opt_get("server");
     if (p)
       printf("Server: %s\n", p);
-    p = settings_opt_get("username");
+    p = settings_opt_get("jid");
     if (p)
-      printf("Username: %s\n", p);
+      printf("User JID: %s\n", p);
 
     pwd = ask_password("Jabber password");
     settings_set(SETTINGS_TYPE_OPTION, "password", pwd);
--- a/mcabber/src/xmpp.c	Sun Oct 11 16:48:15 2009 +0200
+++ b/mcabber/src/xmpp.c	Sun Oct 11 20:06:47 2009 +0200
@@ -852,19 +852,19 @@
 static void connection_open_cb(LmConnection *connection, gboolean success,
                                gpointer user_data)
 {
-  const char *username, *password, *resource, *servername;
+  const char *userjid, *password, *resource, *servername;
   GError *error;
 
   if (success) {
     servername = settings_opt_get("server");
-    username   = settings_opt_get("username");
+    userjid    = settings_opt_get("jid");
     password   = settings_opt_get("password");
     resource   = strchr(lm_connection_get_jid(connection),
                         JID_RESOURCE_SEPARATOR);
     if (resource)
       resource++;
 
-    if (!lm_connection_authenticate(lconnection, username, password, resource,
+    if (!lm_connection_authenticate(lconnection, userjid, password, resource,
                                     connection_auth_cb, NULL, FALSE, &error)) {
       scr_LogPrint(LPRINT_LOGNORM, "Failed to authenticate: %s\n",
                    error->message);
@@ -1562,7 +1562,7 @@
 
 void xmpp_connect(void)
 {
-  const char *username, *password, *resource, *servername, *ssl_fpr;
+  const char *userjid, *password, *resource, *servername, *ssl_fpr;
   char *dynresource = NULL;
   char fpr[16];
   const char *proxy_host;
@@ -1579,23 +1579,18 @@
     xmpp_disconnect();
 
   servername = settings_opt_get("server");
-  username   = settings_opt_get("username");
+  userjid    = settings_opt_get("jid");
   password   = settings_opt_get("password");
   resource   = settings_opt_get("resource");
   proxy_host = settings_opt_get("proxy_host");
   ssl_fpr    = settings_opt_get("ssl_fingerprint");
 
-  if (!servername) {
-    scr_LogPrint(LPRINT_LOGNORM, "Server name has not been specified!");
-    return;
-  }
-
-  if (!username) {
-    scr_LogPrint(LPRINT_LOGNORM, "User name has not been specified!");
+  if (!userjid) {
+    scr_LogPrint(LPRINT_LOGNORM, "Your JID has not been specified!");
     return;
   }
   if (!password) {
-    scr_LogPrint(LPRINT_LOGNORM, "Password has not been specified!");
+    scr_LogPrint(LPRINT_LOGNORM, "Your password has not been specified!");
     return;
   }
 
@@ -1684,8 +1679,10 @@
     }
   }
 
-  fjid = compose_jid(username, servername, resource);
+  fjid = compose_jid(userjid, servername, resource);
   lm_connection_set_jid(lconnection, fjid);
+  if (servername)
+    lm_connection_set_server(lconnection, servername);
 #if defined(HAVE_LIBOTR)
   otr_init(fjid);
 #endif