mcabber/src/jabglue.c
changeset 977 5b01de4ac5e1
parent 960 90ff94f0fbbb
child 986 ed697234bd39
equal deleted inserted replaced
976:d530e5fb506a 977:5b01de4ac5e1
    65   char *ptr;
    65   char *ptr;
    66   char *alias;
    66   char *alias;
    67 
    67 
    68   alias = g_strdup(jid);
    68   alias = g_strdup(jid);
    69 
    69 
    70   if ((ptr = strchr(alias, '/')) != NULL) {
    70   if ((ptr = strchr(alias, JID_RESOURCE_SEPARATOR)) != NULL) {
    71     *ptr = 0;
    71     *ptr = 0;
    72   }
    72   }
    73   return alias;
    73   return alias;
    74 }
    74 }
    75 
    75 
    77                   const char *resource)
    77                   const char *resource)
    78 {
    78 {
    79   char *jid = g_new(char, 3 +
    79   char *jid = g_new(char, 3 +
    80                     strlen(username) + strlen(servername) + strlen(resource));
    80                     strlen(username) + strlen(servername) + strlen(resource));
    81   strcpy(jid, username);
    81   strcpy(jid, username);
    82   if (!strchr(jid, '@')) {
    82   if (!strchr(jid, JID_DOMAIN_SEPARATOR)) {
    83     strcat(jid, "@");
    83     strcat(jid, JID_DOMAIN_SEPARATORSTR);
    84     strcat(jid, servername);
    84     strcat(jid, servername);
    85   }
    85   }
    86   strcat(jid, "/");
    86   strcat(jid, JID_RESOURCE_SEPARATORSTR);
    87   strcat(jid, resource);
    87   strcat(jid, resource);
    88   return jid;
    88   return jid;
    89 }
    89 }
    90 
    90 
    91 inline unsigned char jb_getonline(void)
    91 inline unsigned char jb_getonline(void)
   601     request_fn = &request_time;
   601     request_fn = &request_time;
   602     strreqtype = "time";
   602     strreqtype = "time";
   603   } else
   603   } else
   604     return;
   604     return;
   605 
   605 
   606   if (strchr(jid, '/')) {
   606   if (strchr(jid, JID_RESOURCE_SEPARATOR)) {
   607     // This is a full JID
   607     // This is a full JID
   608     (*request_fn)(jid);
   608     (*request_fn)(jid);
   609     scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, jid);
   609     scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, jid);
   610     return;
   610     return;
   611   }
   611   }
   824   char *jid;
   824   char *jid;
   825   const char *rname, *s;
   825   const char *rname, *s;
   826 
   826 
   827   jid = jidtodisp(from);
   827   jid = jidtodisp(from);
   828 
   828 
   829   rname = strchr(from, '/');
   829   rname = strchr(from, JID_RESOURCE_SEPARATOR);
   830   if (rname) rname++;
   830   if (rname) rname++;
   831 
   831 
   832   // Check for unexpected groupchat messages
   832   // Check for unexpected groupchat messages
   833   // If we receive a groupchat message from a room we're not a member of,
   833   // If we receive a groupchat message from a room we're not a member of,
   834   // this is probably a server issue and the best we can do is to send
   834   // this is probably a server issue and the best we can do is to send
  1300   enum imstatus ust;
  1300   enum imstatus ust;
  1301   char bpprio;
  1301   char bpprio;
  1302   time_t timestamp = 0;
  1302   time_t timestamp = 0;
  1303   xmlnode muc_packet;
  1303   xmlnode muc_packet;
  1304 
  1304 
  1305   rname = strchr(from, '/');
  1305   rname = strchr(from, JID_RESOURCE_SEPARATOR);
  1306   if (rname) rname++;
  1306   if (rname) rname++;
  1307 
  1307 
  1308   r = jidtodisp(from);
  1308   r = jidtodisp(from);
  1309 
  1309 
  1310   // Check for MUC presence packet
  1310   // Check for MUC presence packet
  1388       GSList *roombuddy;
  1388       GSList *roombuddy;
  1389       gchar *mbuf;
  1389       gchar *mbuf;
  1390       gchar *subj = p;
  1390       gchar *subj = p;
  1391       // Get the room (s) and the nickname (r)
  1391       // Get the room (s) and the nickname (r)
  1392       s = g_strdup(from);
  1392       s = g_strdup(from);
  1393       r = strchr(s, '/');
  1393       r = strchr(s, JID_RESOURCE_SEPARATOR);
  1394       if (r) *r++ = 0;
  1394       if (r) *r++ = 0;
  1395       else   r = s;
  1395       else   r = s;
  1396       // Set the new topic
  1396       // Set the new topic
  1397       roombuddy = roster_find(s, jidsearch, 0);
  1397       roombuddy = roster_find(s, jidsearch, 0);
  1398       if (roombuddy)
  1398       if (roombuddy)