CVSTrac Legacy Code

Check-in [d8dd0972d4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:some style cleanups, get rid of unused variables, etc.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d8dd0972d4b1e208b395ae75d63d35dc3ccbc661
User & Date: cpb 2009-03-27 23:53:13
Context
2009-05-14
11:22
(#740) take the SRCDIR path from the platform.mk file placement, a do not hardcode SRCDIR anymore. check-in: 586b227c9a user: ono tags: trunk
2009-03-27
23:53
some style cleanups, get rid of unused variables, etc. check-in: d8dd0972d4 user: cpb tags: trunk
13:40
add support for incoming {link:http://trac.edgewall.org/wiki/InterTrac InterTrac} links. This allows Trac sites to reference CVSTrac objects most naturally.

Outgoing InterTrac links _from_ a CVSTrac install can be accomplished with custom markup, as in:

{quote:%x}

which would be referenced via something like:

{quote:{<markup>: ticket:451 #451}} {quote:{trac: wiki:InterTrac InterTrac}}
check-in: ede2546f24 user: cpb tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to intertrac.c.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77


78
79
80
81
82
83
84
85
**   drh@hwaci.com
**   http://www.hwaci.com/drh/
**
*******************************************************************************
**
** This file contains code used to support the "intertrac" protocol.
*/
#include <time.h>
#include <assert.h>
#include "config.h"
#include "intertrac.h"

/*
** A webpage to redirect intertrac requests
**
** WEBPAGE: /intertrac
*/
void intertrac(void){
  const char *zTime;
  const char *zMsg, *zOldMsg;
  time_t tm = 0;
  int cn;
  int mtype;
  const char *zMType;
  const char *zBr;
  char **az;
  char **azAllBr;
  struct tm *pTm;
  char zDate[200];

  login_check_credentials();
  throttle(1,1);

  /* parse object type and paramter from g.zExtra */
  char *z = strchr(g.zExtra, ':');
  if( z ){
    *(z++) = 0;

    if( !strcmp(g.zExtra,"ticket") ){
	   cgi_redirect(mprintf("%s/tktview?tn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"wiki") ){
	   cgi_redirect(mprintf("%s/wiki?p=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"changeset") || !strcmp(g.zExtra,"milestone")
      || !strcmp(g.zExtra,"log")
    ){
	   cgi_redirect(mprintf("%s/chngview?cn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"report") ){
	   cgi_redirect(mprintf("%s/rptview?rn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"attachment") ){
	   cgi_redirect(mprintf("%s/attach_get/%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"source") ){
	   cgi_redirect(mprintf("%s/fileview?f=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"browser") ){
	   if( is_repository_file(z) ){
		   cgi_redirect(mprintf("%s/fileview?f=%T", g.zBaseURL, z));
	   }else{
		   cgi_redirect(mprintf("%s/dirview?d=%T", g.zBaseURL, z));
	   }


    }

	 /* not found. Fallback to search */
	 cgi_redirect(mprintf("%s/search?s=%T", g.zBaseURL, z));
  }

  cgi_redirect(mprintf("%s/search?s=%T", g.zBaseURL, g.zExtra));
}







<
<









<
<
<
<
<
<
<
|
<
<
<




|
|




|

|

|

|

|

|

|

|
|
|
|
|
>
>


|
|




20
21
22
23
24
25
26


27
28
29
30
31
32
33
34
35







36



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
**   drh@hwaci.com
**   http://www.hwaci.com/drh/
**
*******************************************************************************
**
** This file contains code used to support the "intertrac" protocol.
*/


#include "config.h"
#include "intertrac.h"

/*
** A webpage to redirect intertrac requests
**
** WEBPAGE: /intertrac
*/
void intertrac(void){







  char *z;




  login_check_credentials();
  throttle(1,1);

  /* parse object type and parameter from g.zExtra */
  z = strchr(g.zExtra, ':');
  if( z ){
    *(z++) = 0;

    if( !strcmp(g.zExtra,"ticket") ){
      cgi_redirect(mprintf("%s/tktview?tn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"wiki") ){
      cgi_redirect(mprintf("%s/wiki?p=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"changeset") || !strcmp(g.zExtra,"milestone")
                || !strcmp(g.zExtra,"log")
    ){
      cgi_redirect(mprintf("%s/chngview?cn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"report") ){
      cgi_redirect(mprintf("%s/rptview?rn=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"attachment") ){
      cgi_redirect(mprintf("%s/attach_get/%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"source") ){
      cgi_redirect(mprintf("%s/fileview?f=%T", g.zBaseURL, z));
    }else if( !strcmp(g.zExtra,"browser") ){
      if( is_repository_file(z) ){
        cgi_redirect(mprintf("%s/fileview?f=%T", g.zBaseURL, z));
      }else{
        cgi_redirect(mprintf("%s/dirview?d=%T", g.zBaseURL, z));
      }
    }else if( !strcmp(g.zExtra,"timeline") ){
      cgi_redirect(mprintf("%s/timeline", g.zBaseURL));
    }

    /* not found. Fallback to search */
    cgi_redirect(mprintf("%s/search?s=%T", g.zBaseURL, z));
  }

  cgi_redirect(mprintf("%s/search?s=%T", g.zBaseURL, g.zExtra));
}