src/util.c

changeset 4890
d87a9b5bbe57
parent 4888
09f16a932490
child 4899
b7ccfcabdb57
equal deleted inserted replaced
4889:9c81754db28e 4890:d87a9b5bbe57
598 } 598 }
599 599
600 600
601 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date, 601 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date,
602 or time */ 602 or time */
603 char *away_subs(char *msg, char *name) 603 char *away_subs(const char *msg, const char *name)
604 { 604 {
605 char *c; 605 char *c;
606 static char cpy[BUF_LONG]; 606 static char cpy[BUF_LONG];
607 int cnt = 0; 607 int cnt = 0;
608 time_t t = time(0); 608 time_t t = time(0);
648 } 648 }
649 cpy[cnt] = '\0'; 649 cpy[cnt] = '\0';
650 return (cpy); 650 return (cpy);
651 } 651 }
652 652
653 char *stylize(gchar *text, int length) 653 char *stylize(const gchar *text, int length)
654 { 654 {
655 gchar *buf; 655 gchar *buf;
656 char *tmp = g_malloc(length); 656 char *tmp = g_malloc(length);
657 657
658 buf = g_malloc(length); 658 buf = g_malloc(length);
702 702
703 g_free(tmp); 703 g_free(tmp);
704 return buf; 704 return buf;
705 } 705 }
706 706
707 void show_usage(int mode, char *name) 707 void show_usage(int mode, const char *name)
708 { 708 {
709 switch (mode) { 709 switch (mode) {
710 case 0: /* full help text */ 710 case 0: /* full help text */
711 printf("Gaim %s\n" 711 printf("Gaim %s\n"
712 "Usage: %s [OPTION]...\n\n" 712 "Usage: %s [OPTION]...\n\n"
871 strncpy_withhtml(dest, src, destsize); 871 strncpy_withhtml(dest, src, destsize);
872 872
873 return(dest); 873 return(dest);
874 } 874 }
875 875
876 void away_on_login(char *mesg)
877 {
878 GSList *awy = away_messages;
879 struct away_message *a, *message = NULL;
880 struct gaim_gtk_buddy_list *gtkblist;
881
882 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
883
884 if (!gtkblist->window) {
885 return;
886 }
887
888 if (mesg == NULL) {
889 /* Use default message */
890 do_away_message(NULL, default_away);
891 } else {
892 /* Use argument */
893 while (awy) {
894 a = (struct away_message *)awy->data;
895 if (strcmp(a->name, mesg) == 0) {
896 message = a;
897 break;
898 }
899 awy = awy->next;
900 }
901 if (message == NULL)
902 message = default_away;
903 do_away_message(NULL, message);
904 }
905 return;
906 }
907
908 void strip_linefeed(gchar *text) 876 void strip_linefeed(gchar *text)
909 { 877 {
910 int i, j; 878 int i, j;
911 gchar *text2 = g_malloc(strlen(text) + 1); 879 gchar *text2 = g_malloc(strlen(text) + 1);
912 880

mercurial