Diff
Not logged in

Differences From Artifact [bd4bfcc273]:

To Artifact [db0ea13219]:


359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376


377

378
379
380
381
382
383
384
** Compute a display name from a login name.
**
** If the input login is found in the USER table, then check the USER.INFO
** field to see if it has display-name followed by an email address.
** If it does, that becomes the new display name.  If not, let the display
** name just be the login.
**
** Space to hold the returned name is obtained form fossil_strdup()
** and should be freed by the caller.
*/
char *display_name_from_login(const char *zLogin){
  static Stmt q;
  char *zResult;
  db_static_prepare(&q,
     "SELECT coalesce(display_name(info),$login) FROM user WHERE login=$login"
  );
  db_bind_text(&q, "$login", zLogin);
  db_step(&q);


  zResult = fossil_strdup(db_column_text(&q,0));

  db_reset(&q);
  return zResult;
}


/*
** Display all posts in a forum thread in chronological order







|
|





|


|
>
>
|
>







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
** Compute a display name from a login name.
**
** If the input login is found in the USER table, then check the USER.INFO
** field to see if it has display-name followed by an email address.
** If it does, that becomes the new display name.  If not, let the display
** name just be the login.
**
** Space to hold the returned name is obtained from fossil_strdup() or
** mprintf() and should be freed by the caller.
*/
char *display_name_from_login(const char *zLogin){
  static Stmt q;
  char *zResult;
  db_static_prepare(&q,
     "SELECT display_name(info) FROM user WHERE login=$login"
  );
  db_bind_text(&q, "$login", zLogin);
  if( db_step(&q)==SQLITE_ROW && db_column_type(&q,0)==SQLITE_TEXT ){
    zResult = mprintf("%s (%s)", db_column_text(&q,0), zLogin);
  }else{
    zResult = fossil_strdup(zLogin);
  }
  db_reset(&q);
  return zResult;
}


/*
** Display all posts in a forum thread in chronological order