source: message.c @ e6449bc

barnowl_perlaimdebianowlrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since e6449bc was 09489b89, checked in by James M. Kretchmar <kretch@mit.edu>, 21 years ago
First pass at making owl build without zephyr
  • Property mode set to 100644
File size: 18.0 KB
Line 
1#include <stdlib.h>
2#include <unistd.h>
3#include <string.h>
4#include <sys/socket.h>
5#include <netdb.h>
6#include <sys/types.h>
7#include <sys/socket.h>
8#include <netinet/in.h>
9#include <arpa/inet.h>
10#include <time.h>
11#include "owl.h"
12
13static const char fileIdent[] = "$Id$";
14
15void owl_message_init(owl_message *m)
16{
17  time_t t;
18
19  m->id=owl_global_get_nextmsgid(&g);
20  m->type=OWL_MESSAGE_TYPE_GENERIC;
21  owl_message_set_direction_none(m);
22  m->delete=0;
23  strcpy(m->hostname, "");
24  m->zwriteline=strdup("");
25  m->invalid_format=1;
26
27  owl_list_create(&(m->attributes));
28 
29  /* save the time */
30  t=time(NULL);
31  m->time=owl_strdup(ctime(&t));
32  m->time[strlen(m->time)-1]='\0';
33  owl_fmtext_init_null(&(m->fmtext));
34}
35
36void owl_message_set_attribute(owl_message *m, char *attrname, char *attrvalue)
37{
38  /* add the named attribute to the message.  If an attribute with the
39     name already exists, replace the old value with the new value */
40
41  int i, j;
42  owl_pair *p;
43
44  /* look for an existing pair with this key, and nuke the entry if
45     found */
46  j=owl_list_get_size(&(m->attributes));
47  for (i=0; i<j; i++) {
48    p=owl_list_get_element(&(m->attributes), i);
49    if (!strcmp(owl_pair_get_key(p), attrname)) {
50      owl_free(owl_pair_get_key(p));
51      owl_free(owl_pair_get_value(p));
52      owl_free(p);
53      owl_list_remove_element(&(m->attributes), i);
54      break;
55    }
56  }
57
58  p=owl_malloc(sizeof(owl_pair));
59  owl_pair_create(p, owl_strdup(attrname), owl_strdup(attrvalue));
60  owl_list_append_element(&(m->attributes), p);
61}
62
63char *owl_message_get_attribute_value(owl_message *m, char *attrname)
64{
65  /* return the value associated with the named attribute, or NULL if
66     the attribute does not exist */
67  int i, j;
68  owl_pair *p;
69
70  j=owl_list_get_size(&(m->attributes));
71  for (i=0; i<j; i++) {
72    p=owl_list_get_element(&(m->attributes), i);
73    if (!strcmp(owl_pair_get_key(p), attrname)) {
74      return(owl_pair_get_value(p));
75    }
76  }
77  owl_function_debugmsg("No attribute %s found", attrname);
78  return(NULL);
79}
80
81/* We cheat and indent it for now, since we really want this for
82 * the 'info' function.  Later there should just be a generic
83 * function to indent fmtext.
84 */
85void owl_message_attributes_tofmtext(owl_message *m, owl_fmtext *fm) {
86  int i, j;
87  owl_pair *p;
88  char *buff;
89
90  owl_fmtext_init_null(fm);
91
92  j=owl_list_get_size(&(m->attributes));
93  for (i=0; i<j; i++) {
94    p=owl_list_get_element(&(m->attributes), i);
95    buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p));
96    owl_fmtext_append_normal(fm, buff);
97    owl_free(buff);
98  }
99}
100
101void owl_message_invalidate_format(owl_message *m)
102{
103  m->invalid_format=1;
104}
105
106owl_fmtext *owl_message_get_fmtext(owl_message *m)
107{
108  owl_message_format(m);
109  return(&(m->fmtext));
110}
111
112void owl_message_format(owl_message *m)
113{
114  owl_style *s;
115  owl_view *v;
116
117  if (m->invalid_format) {
118    /* for now we assume there's jsut the one view and use that style */
119    v=owl_global_get_current_view(&g);
120    s=owl_view_get_style(v);
121
122    owl_fmtext_free(&(m->fmtext));
123    owl_fmtext_init_null(&(m->fmtext));
124    owl_style_get_formattext(s, &(m->fmtext), m);
125    m->invalid_format=0;
126  }
127}
128
129void owl_message_set_class(owl_message *m, char *class)
130{
131  owl_message_set_attribute(m, "class", class);
132}
133
134char *owl_message_get_class(owl_message *m)
135{
136  char *class;
137
138  class=owl_message_get_attribute_value(m, "class");
139  if (!class) return("");
140  return(class);
141}
142
143void owl_message_set_instance(owl_message *m, char *inst)
144{
145  owl_message_set_attribute(m, "instance", inst);
146}
147
148char *owl_message_get_instance(owl_message *m)
149{
150  char *instance;
151
152  instance=owl_message_get_attribute_value(m, "instance");
153  if (!instance) return("");
154  return(instance);
155}
156
157void owl_message_set_sender(owl_message *m, char *sender)
158{
159  owl_message_set_attribute(m, "sender", sender);
160}
161
162char *owl_message_get_sender(owl_message *m)
163{
164  char *sender;
165
166  sender=owl_message_get_attribute_value(m, "sender");
167  if (!sender) return("");
168  return(sender);
169}
170
171void owl_message_set_zsig(owl_message *m, char *zsig)
172{
173  owl_message_set_attribute(m, "zsig", zsig);
174}
175
176char *owl_message_get_zsig(owl_message *m)
177{
178  char *zsig;
179
180  zsig=owl_message_get_attribute_value(m, "zsig");
181  if (!zsig) return("");
182  return(zsig);
183}
184
185void owl_message_set_recipient(owl_message *m, char *recip)
186{
187  owl_message_set_attribute(m, "recipient", recip);
188}
189
190char *owl_message_get_recipient(owl_message *m)
191{
192  /* this is stupid for outgoing messages, we need to fix it. */
193
194  char *recip;
195
196  recip=owl_message_get_attribute_value(m, "recipient");
197  if (!recip) return("");
198  return(recip);
199}
200
201void owl_message_set_realm(owl_message *m, char *realm)
202{
203  owl_message_set_attribute(m, "realm", realm);
204}
205
206char *owl_message_get_realm(owl_message *m)
207{
208  char *realm;
209 
210  realm=owl_message_get_attribute_value(m, "realm");
211  if (!realm) return("");
212  return(realm);
213}
214
215void owl_message_set_body(owl_message *m, char *body)
216{
217  owl_message_set_attribute(m, "body", body);
218}
219
220char *owl_message_get_body(owl_message *m)
221{
222  char *body;
223
224  body=owl_message_get_attribute_value(m, "body");
225  if (!body) return("");
226  return(body);
227}
228
229
230void owl_message_set_opcode(owl_message *m, char *opcode)
231{
232  owl_message_set_attribute(m, "opcode", opcode);
233}
234
235char *owl_message_get_opcode(owl_message *m)
236{
237  char *opcode;
238
239  opcode=owl_message_get_attribute_value(m, "opcode");
240  if (!opcode) return("");
241  return(opcode);
242}
243
244
245void owl_message_set_islogin(owl_message *m)
246{
247  owl_message_set_attribute(m, "loginout", "login");
248}
249
250
251void owl_message_set_islogout(owl_message *m)
252{
253  owl_message_set_attribute(m, "loginout", "logout");
254}
255
256int owl_message_is_loginout(owl_message *m)
257{
258  char *res;
259
260  res=owl_message_get_attribute_value(m, "loginout");
261  if (!res) return(0);
262  return(1);
263}
264
265int owl_message_is_login(owl_message *m)
266{
267  char *res;
268
269  res=owl_message_get_attribute_value(m, "loginout");
270  if (!res) return(0);
271  if (!strcmp(res, "login")) return(1);
272  return(0);
273}
274
275
276int owl_message_is_logout(owl_message *m)
277{
278  char *res;
279
280  res=owl_message_get_attribute_value(m, "loginout");
281  if (!res) return(0);
282  if (!strcmp(res, "logout")) return(1);
283  return(0);
284}
285
286void owl_message_set_isprivate(owl_message *m)
287{
288  owl_message_set_attribute(m, "isprivate", "");
289}
290
291int owl_message_is_private(owl_message *m)
292{
293  char *res;
294
295  res=owl_message_get_attribute_value(m, "isprivate");
296  if (!res) return(0);
297  return(1);
298}
299
300char *owl_message_get_timestr(owl_message *m)
301{
302  return(m->time);
303}
304
305void owl_message_set_type_admin(owl_message *m)
306{
307  m->type=OWL_MESSAGE_TYPE_ADMIN;
308}
309
310void owl_message_set_type_zephyr(owl_message *m)
311{
312  m->type=OWL_MESSAGE_TYPE_ZEPHYR;
313}
314
315void owl_message_set_type_aim(owl_message *m)
316{
317  m->type=OWL_MESSAGE_TYPE_AIM;
318}
319                                               
320int owl_message_is_type_admin(owl_message *m)
321{
322  if (m->type==OWL_MESSAGE_TYPE_ADMIN) return(1);
323  return(0);
324}
325
326int owl_message_is_type_zephyr(owl_message *m)
327{
328  if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) return(1);
329  return(0);
330}
331
332int owl_message_is_type_aim(owl_message *m)
333{
334  if (m->type==OWL_MESSAGE_TYPE_AIM) return(1);
335  return(0);
336}
337
338int owl_message_is_type_generic(owl_message *m)
339{
340  if (m->type==OWL_MESSAGE_TYPE_GENERIC) return(1);
341  return(0);
342}
343
344char *owl_message_type_to_string(owl_message *m)
345{
346  if (m->type==OWL_MESSAGE_TYPE_ADMIN) return("admin");
347  if (m->type==OWL_MESSAGE_TYPE_GENERIC) return("generic");
348  if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) return("zephyr");
349  if (m->type==OWL_MESSAGE_TYPE_AIM) return("aim");
350  if (m->type==OWL_MESSAGE_TYPE_JABBER) return("jabber");
351  if (m->type==OWL_MESSAGE_TYPE_ICQ) return("icq");
352  if (m->type==OWL_MESSAGE_TYPE_MSN) return("msn");
353  return("unknown");
354}
355
356char *owl_message_get_text(owl_message *m)
357{
358  return(owl_fmtext_get_text(&(m->fmtext)));
359}
360
361void owl_message_set_direction_in(owl_message *m)
362{
363  m->direction=OWL_MESSAGE_DIRECTION_IN;
364}
365
366void owl_message_set_direction_out(owl_message *m)
367{
368  m->direction=OWL_MESSAGE_DIRECTION_OUT;
369}
370
371void owl_message_set_direction_none(owl_message *m)
372{
373  m->direction=OWL_MESSAGE_DIRECTION_NONE;
374}
375
376int owl_message_is_direction_in(owl_message *m)
377{
378  if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
379  return(0);
380}
381
382int owl_message_is_direction_out(owl_message *m)
383{
384  if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
385  return(0);
386}
387
388int owl_message_is_direction_none(owl_message *m)
389{
390  if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
391  return(0);
392}
393
394int owl_message_get_numlines(owl_message *m)
395{
396  if (m == NULL) return(0);
397  owl_message_format(m);
398  return(owl_fmtext_num_lines(&(m->fmtext)));
399}
400
401void owl_message_mark_delete(owl_message *m)
402{
403  if (m == NULL) return;
404  m->delete=1;
405}
406
407void owl_message_unmark_delete(owl_message *m)
408{
409  if (m == NULL) return;
410  m->delete=0;
411}
412
413char *owl_message_get_zwriteline(owl_message *m)
414{
415  return(m->zwriteline);
416}
417
418void owl_message_set_zwriteline(owl_message *m, char *line)
419{
420  m->zwriteline=strdup(line);
421}
422
423int owl_message_is_delete(owl_message *m)
424{
425  if (m == NULL) return(0);
426  if (m->delete==1) return(1);
427  return(0);
428}
429
430#ifdef HAVE_LIBZEPHYR
431ZNotice_t *owl_message_get_notice(owl_message *m)
432{
433  return(&(m->notice));
434}
435#else
436void *owl_message_get_notice(owl_message *m)
437{
438  return(NULL);
439}
440#endif
441
442char *owl_message_get_hostname(owl_message *m)
443{
444  return(m->hostname);
445}
446
447
448void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color)
449{
450  owl_fmtext a, b;
451
452  /* this will ensure that our cached copy is up to date */
453  owl_message_format(m);
454
455  owl_fmtext_init_null(&a);
456  owl_fmtext_init_null(&b);
457 
458  owl_fmtext_truncate_lines(&(m->fmtext), aline, bline-aline+1, &a);
459  owl_fmtext_truncate_cols(&a, acol, bcol, &b);
460  if (color!=OWL_COLOR_DEFAULT) {
461    owl_fmtext_colorize(&b, color);
462  }
463
464  if (owl_global_is_search_active(&g)) {
465    owl_fmtext_search_and_highlight(&b, owl_global_get_search_string(&g));
466  }
467     
468  owl_fmtext_curs_waddstr(&b, win);
469
470  owl_fmtext_free(&a);
471  owl_fmtext_free(&b);
472}
473
474int owl_message_is_personal(owl_message *m)
475{
476  if (owl_message_is_type_zephyr(m)) {
477    if (strcasecmp(owl_message_get_class(m), "message")) return(0);
478    if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
479    if (!strcasecmp(owl_message_get_recipient(m), owl_zephyr_get_sender()) ||
480        !strcasecmp(owl_message_get_sender(m), owl_zephyr_get_sender())) {
481      return(1);
482    }
483  }
484  return(0);
485}
486
487int owl_message_is_from_me(owl_message *m)
488{
489  if (owl_message_is_type_zephyr(m)) {
490    if (!strcasecmp(owl_message_get_sender(m), owl_zephyr_get_sender())) {
491      return(1);
492    } else {
493      return(0);
494    }
495  } else if (owl_message_is_type_aim(m)) {
496    if (!strcasecmp(owl_message_get_sender(m), owl_global_get_aim_screenname(&g))) {
497      return(1);
498    } else {
499      return(0);
500    }
501  } else if (owl_message_is_type_admin(m)) {
502    return(0);
503  }
504  return(0);
505}
506
507int owl_message_is_mail(owl_message *m)
508{
509  if (owl_message_is_type_zephyr(m)) {
510    if (!strcasecmp(owl_message_get_class(m), "mail") && owl_message_is_private(m)) {
511      return(1);
512    } else {
513      return(0);
514    }
515  }
516  return(0);
517}
518
519int owl_message_is_ping(owl_message *m)
520{
521  if (owl_message_is_type_zephyr(m)) {
522    if (!strcasecmp(owl_message_get_opcode(m), "ping")) {
523      return(1);
524    } else {
525      return(0);
526    }
527  }
528  return(0);
529}
530
531int owl_message_is_burningears(owl_message *m)
532{
533  /* we should add a global to cache the short zsender */
534  char sender[LINE], *ptr;
535
536  /* if the message is from us or to us, it doesn't count */
537  if (owl_message_is_from_me(m) || owl_message_is_private(m)) return(0);
538
539  if (owl_message_is_type_zephyr(m)) {
540    strcpy(sender, owl_zephyr_get_sender());
541    ptr=strchr(sender, '@');
542    if (ptr) *ptr='\0';
543  } else if (owl_message_is_type_aim(m)) {
544    strcpy(sender, owl_global_get_aim_screenname(&g));
545  } else {
546    return(0);
547  }
548
549  if (stristr(owl_message_get_body(m), sender)) {
550    return(1);
551  }
552  return(0);
553}
554
555/* caller must free return value. */
556char *owl_message_get_cc(owl_message *m)
557{
558  char *cur, *out, *end;
559
560  cur = owl_message_get_body(m);
561  while (*cur && *cur==' ') cur++;
562  if (strncasecmp(cur, "cc:", 3)) return(NULL);
563  cur+=3;
564  while (*cur && *cur==' ') cur++;
565  out = owl_strdup(cur);
566  end = strchr(out, '\n');
567  if (end) end[0] = '\0';
568  return(out);
569}
570
571int owl_message_get_id(owl_message *m)
572{
573  return(m->id);
574}
575
576/* return 1 if the message contains "string", 0 otherwise.  This is
577 * case insensitive because the functions it uses are
578 */
579int owl_message_search(owl_message *m, char *string)
580{
581
582  owl_message_format(m); /* is this necessary? */
583 
584  return (owl_fmtext_search(&(m->fmtext), string));
585}
586
587
588/* if loginout == -1 it's a logout message
589 *                 0 it's not a login/logout message
590 *                 1 it's a login message
591 */
592void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text, int direction, int loginout)
593{
594  owl_message_init(m);
595  owl_message_set_body(m, text);
596  owl_message_set_sender(m, sender);
597  owl_message_set_recipient(m, recipient);
598  owl_message_set_type_aim(m);
599
600  if (direction==OWL_MESSAGE_DIRECTION_IN) {
601    owl_message_set_direction_in(m);
602  } else if (direction==OWL_MESSAGE_DIRECTION_OUT) {
603    owl_message_set_direction_out(m);
604  }
605
606  /* for now all messages that aren't loginout are private */
607  if (!loginout) {
608    owl_message_set_isprivate(m);
609  }
610
611  if (loginout==-1) {
612    owl_message_set_islogout(m);
613  } else if (loginout==1) {
614    owl_message_set_islogin(m);
615  }
616}
617
618void owl_message_create_admin(owl_message *m, char *header, char *text)
619{
620  owl_message_init(m);
621  owl_message_set_type_admin(m);
622  owl_message_set_body(m, text);
623  owl_message_set_attribute(m, "adminheader", header); /* just a hack for now */
624}
625
626#ifdef HAVE_LIBZEPHYR
627void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n)
628{
629  struct hostent *hent;
630  int k;
631  char *ptr, *tmp, *tmp2;
632
633  owl_message_init(m);
634 
635  owl_message_set_type_zephyr(m);
636  owl_message_set_direction_in(m);
637 
638  /* first save the full notice */
639  memcpy(&(m->notice), n, sizeof(ZNotice_t));
640
641  /* a little gross, we'll reaplace \r's with ' ' for now */
642  owl_zephyr_hackaway_cr(&(m->notice));
643 
644  m->delete=0;
645
646  /* set other info */
647  owl_message_set_sender(m, n->z_sender);
648  owl_message_set_class(m, n->z_class);
649  owl_message_set_instance(m, n->z_class_inst);
650  owl_message_set_recipient(m, n->z_recipient);
651  if (n->z_opcode) {
652    owl_message_set_opcode(m, n->z_opcode);
653  } else {
654    owl_message_set_opcode(m, "");
655  }
656  owl_message_set_zsig(m, n->z_message);
657
658  if ((ptr=strchr(n->z_recipient, '@'))!=NULL) {
659    owl_message_set_realm(m, ptr+1);
660  } else {
661    owl_message_set_realm(m, owl_zephyr_get_realm());
662  }
663
664  /* Set the "isloginout" attribute if it's a login message */
665  if (!strcasecmp(n->z_class, "login") || !strcasecmp(n->z_class, OWL_WEBZEPHYR_CLASS)) {
666    if (!strcasecmp(n->z_opcode, "user_login")) {
667      owl_message_set_islogin(m);
668    } else if (!strcasecmp(n->z_opcode, "user_logout")) {
669      owl_message_set_islogout(m);
670    }
671  }
672
673  /* is the "isprivate" attribute if it's a private zephyr */
674  if (!strcasecmp(n->z_recipient, owl_zephyr_get_sender())) {
675    owl_message_set_isprivate(m);
676  }
677
678  m->zwriteline=strdup("");
679
680  /* set the body */
681  ptr=owl_zephyr_get_message(n, &k);
682  tmp=owl_malloc(k+10);
683  memcpy(tmp, ptr, k);
684  tmp[k]='\0';
685  if (owl_global_is_newlinestrip(&g)) {
686    tmp2=owl_util_stripnewlines(tmp);
687    owl_message_set_body(m, tmp2);
688    owl_free(tmp2);
689  } else {
690    owl_message_set_body(m, tmp);
691  }
692  owl_free(tmp);
693
694#ifdef OWL_ENABLE_ZCRYPT
695  /* if zcrypt is enabled try to decrypt the message */
696  if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {
697    char *out;
698    int ret;
699
700    out=owl_malloc(strlen(owl_message_get_body(m))*16+20);
701    ret=zcrypt_decrypt(out, owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m));
702    if (ret==0) {
703      owl_message_set_body(m, out);
704    } else {
705      owl_free(out);
706    }
707  }
708#endif 
709
710  /* save the hostname */
711  owl_function_debugmsg("About to do gethostbyaddr");
712  hent=gethostbyaddr((char *) &(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET);
713  if (hent && hent->h_name) {
714    strcpy(m->hostname, hent->h_name);
715  } else {
716    strcpy(m->hostname, inet_ntoa(n->z_sender_addr));
717  }
718
719  /* save the time */
720  m->time=owl_strdup(ctime((time_t *) &n->z_time.tv_sec));
721  m->time[strlen(m->time)-1]='\0';
722}
723#else
724void owl_message_create_from_znotice(owl_message *m, void *n)
725{
726}
727#endif
728
729void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig)
730{
731  owl_zwrite z;
732  int ret;
733 
734  owl_message_init(m);
735
736  /* create a zwrite for the purpose of filling in other message fields */
737  owl_zwrite_create_from_line(&z, line);
738
739  /* set things */
740  owl_message_set_direction_out(m);
741  owl_message_set_type_zephyr(m);
742  owl_message_set_sender(m, owl_zephyr_get_sender());
743  owl_message_set_class(m, owl_zwrite_get_class(&z));
744  owl_message_set_instance(m, owl_zwrite_get_instance(&z));
745  owl_message_set_recipient(m,
746                            long_zuser(owl_zwrite_get_recip_n(&z, 0))); /* only gets the first user, must fix */
747  owl_message_set_opcode(m, owl_zwrite_get_opcode(&z));
748  owl_message_set_realm(m, owl_zwrite_get_realm(&z)); /* also a hack, but not here */
749  m->zwriteline=owl_strdup(line);
750  owl_message_set_body(m, body);
751  owl_message_set_zsig(m, zsig);
752 
753  /* save the hostname */
754  ret=gethostname(m->hostname, MAXHOSTNAMELEN);
755  if (ret) {
756    strcpy(m->hostname, "localhost");
757  }
758
759  owl_zwrite_free(&z);
760}
761
762
763void owl_message_pretty_zsig(owl_message *m, char *buff)
764{
765  /* stick a one line version of the zsig in buff */
766  char *ptr;
767
768  strcpy(buff, owl_message_get_zsig(m));
769  ptr=strchr(buff, '\n');
770  if (ptr) ptr[0]='\0';
771}
772
773void owl_message_free(owl_message *m)
774{
775  int i, j;
776  owl_pair *p;
777#ifdef HAVE_LIBZEPHYR   
778  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
779    ZFreeNotice(&(m->notice));
780  }
781#endif
782  if (m->time) owl_free(m->time);
783  if (m->zwriteline) owl_free(m->zwriteline);
784
785  /* free all the attributes */
786  j=owl_list_get_size(&(m->attributes));
787  for (i=0; i<j; i++) {
788    p=owl_list_get_element(&(m->attributes), i);
789    owl_free(owl_pair_get_key(p));
790    owl_free(owl_pair_get_value(p));
791    owl_free(p);
792  }
793
794  owl_list_free_simple(&(m->attributes));
795 
796  owl_fmtext_free(&(m->fmtext));
797}
Note: See TracBrowser for help on using the repository browser.